home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / MonitorIT 5.2.06 / monitorit_fullsetup.exe / data1.cab / Js / AdminAlertFunc1.js next >
Encoding:
JavaScript  |  2003-06-24  |  82.8 KB  |  2,393 lines

  1. /* ======================================================================
  2. DESC: Common Alert Functions for the Administer/Analyze Operations
  3.  
  4. PLATFORMS: >= MS IE 4.0
  5.  
  6. USAGE NOTES: 
  7. ====================================================================== */
  8.  
  9. // Syslog Check Handling
  10. function processSyslogCheckAdd() {
  11.     var LogSus = (AL_Suspend.checked) ? "0" :"1";
  12.     var AndCheck = (AL_SLAnd.checked) ? "1" :"0";
  13.     var ExpCheck = "0";
  14.     var Precedence = AL_SLPrec.selectedIndex;
  15.     // Build fixed part of argument string
  16.     var pStrg = curAGRPID+"~"+LogSus+"~"+GetSelectedFacilities()+"~"+GetSelectedSeverities()+"~"+AndCheck+"~"+ExpCheck+"~";
  17.     pStrg += Precedence+"~"+AL_SLTag.value+"`"+AL_SLContent.value+"`";
  18.  
  19.     // Append Computer IDs
  20.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  21.         pStrg += ";"+ELM_Ar[i];
  22.     }
  23.     if ( RpmCC_AL.SyslogCheckAdd(pStrg) ) { 
  24.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  25.         processResetButton();
  26.     }
  27.     else { // waiting for OperationCompleteEvent
  28.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  29.         processGeneralClick(CounterTab);
  30.     }
  31. }
  32. function processSLAddOpComplete(SLAStat) {
  33.     var wrkarr = new Array();
  34.     wrkarr = SLAStat.split(":"); // parse the lookup record
  35.     if ( wrkarr[0] == "Err" ) {
  36.         ALMode = ""; // reset mode
  37.         top.Rstatus.Pstat(SLAStat,true);
  38.         processResetButton(); // go reset
  39.         return;
  40.     }
  41.     ALupMode = "";
  42.     ALMode = ""; // reset mode
  43.     processAlLookupReset();
  44. }
  45. /* Initiate read for File Check Computers */
  46. function processPopulateSyslogCheckComputers() {
  47.     if ( RpmCC_AL.SyslogCheckLookup(curAGRPID) ) {
  48.         ALupMode = "";
  49.         PINP_Bsy = false;
  50.         top.Rstatus.Pstat("Unable to start the Computer lookup request",true);
  51.     }
  52.     else {
  53.         CompIdLupArr = ""; // Computer Id Array
  54.         ALupMode = "SLComputerLookupPopIn"; // Mode
  55.         top.Rstatus.Pstat("One moment while Computer lookup request completes");
  56.     }
  57. }
  58. function processSLLookupOpComplete(SLLStat) {
  59.     var wrkarr = new Array();
  60.     var pararr = new Array();
  61.     var tarr = new Array();
  62.     var farr = new Array();
  63.     wrkarr = SLLStat.split(":"); // parse the lookup record
  64.     if ( wrkarr[0] == "Err" ) {
  65.         ALMode = ""; // reset mode
  66.         top.Rstatus.Pstat(SLLStat,true);
  67.         processPopInError(); // go reset
  68.         return;
  69.     }
  70.     wrkarr = SLLStat.split(";"); // parse the lookup record
  71.     pararr = wrkarr[0].split("~"); // get Alert Group parameters
  72.     
  73.     // List selected Facilities
  74.     for ( var i=0; i<=FacilityMax; i++ ) {
  75.        FACObjectCheckArr[i] = "0";       
  76.     }    
  77.     farr = pararr[1].split(",");
  78.     for ( var i=0; i<farr.length; i++ ) {
  79.         FACObjectCheckArr[parseInt(farr[i],10)] = "1";       
  80.     }
  81.     displayFACObjectChoices(0); // display them
  82.  
  83.     // List selected Severities
  84.     for ( var i=0; i<=SeverityMax; i++ ) {
  85.        SEVObjectCheckArr[i] = "0";       
  86.     }    
  87.     farr = pararr[2].split(",");
  88.     for ( var i=0; i<farr.length; i++ ) {
  89.         SEVObjectCheckArr[parseInt(farr[i],10)] = "1";       
  90.     }
  91.     displayFACObjectChoices(1); // display them
  92.     
  93.     AL_SLAnd.checked = (pararr[3] == "0") ? "": "checked";    
  94.     AL_SLPrec.selectedIndex = parseInt(pararr[5],10);
  95.     tarr = pararr[6].split("`");
  96.     AL_SLTag.value = tarr[0];
  97.     AL_SLContent.value = tarr[1];    
  98.     AL_Suspend.checked = (tarr[3] == "1") ? "": "checked";    
  99.     
  100.     CompIdLupArr = wrkarr[1]; // get Computer ID array
  101.     wrkarr = CompIdLupArr.split(",");
  102.     CountOfCompsRcvd = wrkarr.length;
  103.     AL_CCOneSyslogCheck.style.overflow = ( CountOfCompsRcvd > 9 ) ? "scroll" : "";
  104.     processPopulateCounterInputComplete();
  105. }
  106. function processSyslogCheckEdit() {
  107.     var LogSus = (AL_Suspend.checked) ? "0" :"1";
  108.     var AndCheck = (AL_SLAnd.checked) ? "1" :"0";
  109.     var ExpCheck = "0";
  110.     var Precedence = AL_SLPrec.selectedIndex;
  111.     // Build fixed part of argument string
  112.     var pStrg = curAGRPID+"~"+LogSus+"~"+GetSelectedFacilities()+"~"+GetSelectedSeverities()+"~"+AndCheck+"~"+ExpCheck+"~";
  113.     pStrg += Precedence+"~"+AL_SLTag.value+"`"+AL_SLContent.value+"`";
  114.  
  115.     // Append Computer IDs
  116.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  117.         pStrg += ";"+ELM_Ar[i];
  118.     }
  119.     if ( RpmCC_AL.SyslogCheckReplace(pStrg) ) { 
  120.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  121.         processResetButton();
  122.     }
  123.     else { // waiting for OperationCompleteEvent
  124.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  125.         processGeneralClick(CounterTab);
  126.     }
  127. }
  128. function processSLReplaceOpComplete(SLRStat) {
  129.     var wrkarr = new Array();
  130.     wrkarr = SLRStat.split(":"); // parse the lookup record
  131.     if ( wrkarr[0] == "Err" ) {
  132.         ALMode = ""; // reset mode
  133.         top.Rstatus.Pstat(SLRStat,true);
  134.         processResetButton(); // go reset
  135.     }
  136.     else {
  137.         ALMode = "";
  138.         finishEditComplete();
  139.     }
  140. }
  141.  
  142. function processSLDeleteOpComplete(SLDStat) {
  143. }
  144.  
  145. function GetSelectedSeverities() {
  146.     var SArr = "";
  147.     for ( var i=0; i<=SeverityMax; i++ ) {
  148.        if ( SEVObjectCheckArr[i] == "1" ) {
  149.            if ( SArr.length > 0 ) SArr += ",";
  150.            SArr += i;
  151.        }
  152.    }
  153.    return SArr;
  154. }
  155. function GetSelectedFacilities() {
  156.     var SArr = "";
  157.     for ( var i=0; i<=FacilityMax; i++ ) {
  158.        if ( FACObjectCheckArr[i] == "1" ) {
  159.            if ( SArr.length > 0 ) SArr += ",";
  160.            SArr += i;
  161.        }
  162.    }
  163.    return SArr;
  164. }
  165.  
  166. var FSFlag = 0;
  167. function procFacilityClick() {
  168.     if ( ALMode == "New" || ALMode == "Edit" ) {
  169.         FSFlag = 0;
  170.         SyslogText.innerText = "Select SYSLOG Facility Codes For Watching";
  171.         processFacilityList();
  172.     }   
  173. }
  174. function procSeverityClick() {
  175.     if ( ALMode == "New" || ALMode == "Edit" ) {
  176.         FSFlag = 1;
  177.         SyslogText.innerText = "Select SYSLOG Severity Codes For Watching";
  178.         processFacilityList();
  179.     }   
  180. }
  181. FACObjectCheckArr = new Array();
  182. SEVObjectCheckArr = new Array();
  183. function processFacilityList() {    
  184.     FAC_Data.style.backgroundColor = "white";
  185.     PopUpFAC.style.display = "";
  186.     var CCEs = "";
  187.     var FSMax = (FSFlag == 0) ? FacilityMax : SeverityMax;
  188.     var FSCode = "";
  189.     for ( var i=0; i<=FSMax; i++ ) {
  190.         CCEs += "<table border='0' cellpadding='1' cellSpacing='0' width='230'><tr>";
  191.           CCEs += "<td width='10'></td><td width='11' align='center'><img id='oid_chk"+i;
  192.         if ( ((FSFlag == 0) ? FACObjectCheckArr[i] : SEVObjectCheckArr[i]) == "1" ) {
  193.            CCEs += "' checked='1' src='images/Checked.gif'"; 
  194.         }
  195.         else {
  196.            CCEs += "' checked='0' src='images/Unchecked.gif'";
  197.         }
  198.           CCEs += "style='cursor:hand' onclick='procFACCmpImgClick(this)' width='9' height='9'></td>";
  199.         CCEs += "<td width='*' id='oid_nme"+i;
  200.         FSCode = (FSFlag == 0) ?  GetFacility(""+i) :  GetSeverity(""+i);
  201.         CCEs += "' style='cursor:hand' onclick='procFACCmpImgClick(this)' class='optext'>  " + FSCode +"</td>";
  202.         CCEs += "</tr></table>";
  203.     }
  204.       FAC_Data.style.overflow = ( i > 15 ) ? "scroll" : "";
  205.     FAC_Data.innerHTML = CCEs;
  206. }
  207. function processFAC_OK() {
  208.     PopUpFAC.style.display = "none";
  209.     if ( CurrentAT == ProcessCheckType ) {
  210.         AL_ProcessName.value = EnumProcesses.options[EnumProcesses.selectedIndex].text;
  211.         AL_ProcessPath.value = EnumProcesses.options[EnumProcesses.selectedIndex].value;
  212.         processProcNotify();
  213.         return;
  214.     }
  215.     displayFACObjectChoices(FSFlag); // display them
  216. }
  217. function processFAC_Cancel() {
  218.     PopUpFAC.style.display = "none";
  219. }
  220. /* Process Click to Check or Uncheck an OID */
  221. function procFACCmpImgClick(CmpIm) {
  222.     isx = CmpIm.id;  
  223.     if ( isx.charAt(0) != "o") 
  224.                 return;
  225.     var cx = isx.substring(7,isx.length); // Strip off index
  226.     var CObj = document.all["oid_chk"+cx]; // Clicked Check box
  227.     if ( CObj.checked == "1" ) { // if currently Checked, Uncheck
  228.         CObj.src = "images/Unchecked.gif";
  229.        CObj.checked = "0"; // Set Unchecked
  230.        if ( FSFlag == 0) 
  231.             FACObjectCheckArr[[parseInt(cx,10)]] = "0";
  232.         else
  233.             SEVObjectCheckArr[[parseInt(cx,10)]] = "0";
  234.    }
  235.     else { // otherwise Check
  236.         CObj.src = "images/Checked.gif";
  237.        CObj.checked = "1"; // Set Checked
  238.        if ( FSFlag == 0)
  239.             FACObjectCheckArr[[parseInt(cx,10)]] = "1";
  240.         else
  241.             SEVObjectCheckArr[[parseInt(cx,10)]] = "1";
  242.     }
  243. }
  244. function displayFACObjectChoices(FSF) {
  245.     if (CurSelTab != "CounterTab") 
  246.         return; // don't update if not visible
  247.     if ( FSF == 0 ) {
  248.         AL_SLFacility.innerHTML = ""; // clear
  249.         for ( var i=0; i<FACObjectCheckArr.length; i++ ) {
  250.             if ( FACObjectCheckArr[i] == "1" ) { // if Chosen
  251.                 addElementToSelect(AL_SLFacility,GetFacility(""+i));
  252.             }
  253.         }
  254.     }
  255.     else {
  256.         AL_SLSeverity.innerHTML = ""; // clear
  257.         for ( var i=0; i<SEVObjectCheckArr.length; i++ ) {
  258.             if ( SEVObjectCheckArr[i] == "1" ) { // if Chosen
  259.                 addElementToSelect(AL_SLSeverity,GetSeverity(""+i));
  260.             }
  261.         }
  262.     }
  263. }    
  264.  
  265. var FacilityMax = 23;
  266. function GetFacility(FacCode) {
  267.     var csFacility;
  268.     switch ( parseInt(FacCode) )
  269.     {
  270.     case 0: csFacility = "Kernel"; break;
  271.     case 1: csFacility = "User-Level"; break;
  272.     case 2: csFacility = "Mail System"; break;
  273.     case 3: csFacility = "System Daemons"; break;
  274.     case 4: csFacility = "Security/Authorization (4)"; break;
  275.     case 5: csFacility = "Internal by Syslogd"; break;
  276.     case 6: csFacility = "Line Printer Subsystem"; break;
  277.     case 7: csFacility = "Network News Subsystem"; break;
  278.     case 8: csFacility = "UUCP Subsystem"; break;
  279.     case 9: csFacility = "Clock Daemon (9)"; break;
  280.     case 10: csFacility = "Security/Authorization (10)"; break;
  281.     case 11: csFacility = "FTP Daemon"; break;
  282.     case 12: csFacility = "NTP Subsystem"; break;
  283.     case 13: csFacility = "Log Audit"; break;
  284.     case 14: csFacility = "Log Alert"; break;
  285.     case 15: csFacility = "Clock Daemon (15)"; break;
  286.     case 16: csFacility = "Local Use 0"; break;
  287.     case 17: csFacility = "Local Use 1"; break;
  288.     case 18: csFacility = "Local Use 2"; break;
  289.     case 19: csFacility = "Local Use 3"; break;
  290.     case 20: csFacility = "Local Use 4"; break;
  291.     case 21: csFacility = "Local Use 5"; break;
  292.     case 22: csFacility = "Local Use 6"; break;
  293.     case 23: csFacility = "Local Use 7"; break;
  294.     default:
  295.         csFacility = FacCode;
  296.     }
  297.     return csFacility;
  298. }
  299.  
  300. var SeverityMax = 7;
  301. function GetSeverity(SevCode) {
  302.     var csSeverity;
  303.     switch ( parseInt(SevCode,10) )
  304.     {
  305.     case 0: csSeverity = "Emergency"; break;
  306.     case 1: csSeverity = "Alert"; break;
  307.     case 2: csSeverity = "Critical"; break;
  308.     case 3: csSeverity = "Error"; break;
  309.     case 4: csSeverity = "Warning"; break;
  310.     case 5: csSeverity = "Notice"; break;
  311.     case 6: csSeverity = "Informational"; break;
  312.     case 7: csSeverity = "Debug"; break;
  313.     default:
  314.         csSeverity = SevCode;
  315.     }
  316.     return csSeverity;
  317. }
  318. //------------------------------------------------------------------------------
  319. // File Check Handling
  320. function processFileCheckAdd() {
  321.     var LogSus = (AL_Suspend.checked) ? "0" :"1";
  322.     // Build fixed part of argument string
  323.     var pStrg = curAGRPID+"~"+LogSus+"~"+AL_FileCheckPath.value+"~"+AL_FileCheckString.value+"`"+AL_FileCheckSize.value;
  324.     pStrg += "`"+((AL_DeltaSize.checked)?"1":"0")+"`"+((AL_DeltaDT.checked)?"1":"0");
  325.     pStrg += "`"+((AL_FileAnd.checked)?"1":"0")+"`"+((AL_FileNot.checked)?"1":"0");
  326.     pStrg += "`"+AL_FileInterval.value+"`"+""; //AL_FCPrec.selectedIndex;
  327.  
  328.     // Append Computer IDs
  329.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  330.         pStrg += ";"+ELM_Ar[i];
  331.     }
  332.     if ( RpmCC_AL.FileCheckAdd(pStrg) ) { 
  333.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  334.         processResetButton();
  335.     }
  336.     else { // waiting for OperationCompleteEvent
  337.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  338.         processGeneralClick(CounterTab);
  339.     }
  340. }
  341. function processFCAddOpComplete(FCAStat) {
  342.     var wrkarr = new Array();
  343.     wrkarr = FCAStat.split(":"); // parse the lookup record
  344.     if ( wrkarr[0] == "Err" ) {
  345.         ALMode = ""; // reset mode
  346.         top.Rstatus.Pstat(FCAStat,true);
  347.         processResetButton(); // go reset
  348.         return;
  349.     }
  350.     ALupMode = "";
  351.     ALMode = ""; // reset mode
  352.     processAlLookupReset();
  353. }
  354. /* Initiate read for File Check Computers */
  355. function processPopulateFileCheckComputers() {
  356.     if ( RpmCC_AL.FileCheckLookup(curAGRPID) ) {
  357.         ALupMode = "";
  358.         PINP_Bsy = false;
  359.         top.Rstatus.Pstat("Unable to start the Computer lookup request",true);
  360.     }
  361.     else {
  362.         CompIdLupArr = ""; // Computer Id Array
  363.         ALupMode = "FCComputerLookupPopIn"; // Mode
  364.         top.Rstatus.Pstat("One moment while Computer lookup request completes");
  365.     }
  366. }
  367. function processFCLookupOpComplete(FCLStat) {
  368.     var wrkarr = new Array();
  369.     var pararr = new Array();
  370.     wrkarr = FCLStat.split(":"); // parse the lookup record
  371.     if ( wrkarr[0] == "Err" ) {
  372.         ALMode = ""; // reset mode
  373.         top.Rstatus.Pstat(FCLStat,true);
  374.         processPopInError(); // go reset
  375.         return;
  376.     }
  377.     wrkarr = FCLStat.split(";"); // parse the lookup record
  378.     pararr = wrkarr[0].split("~"); // get Alert Group parameters
  379.     CompIdLupArr = wrkarr[1]; // get Computer ID array
  380.     wrkarr = CompIdLupArr.split(",");
  381.     CountOfCompsRcvd = wrkarr.length;
  382.     AL_FileCheckPath.value = pararr[1];
  383.     wrkarr = pararr[2].split("`");
  384.     AL_FileCheckString.value = wrkarr[0];
  385.     AL_FileCheckSize.value = wrkarr[1];
  386.     AL_DeltaSize.checked = (wrkarr[2] == "1") ? "checked" : "";
  387.     AL_DeltaDT.checked = (wrkarr[3] == "1") ? "checked" : "";
  388.     if ( wrkarr.length >= 5 ) {
  389.         AL_FileAnd.checked = (wrkarr[4] == "1") ? "checked" : "";
  390.         AL_FileNot.checked = (wrkarr[5] == "1") ? "checked" : "";
  391.         AL_FileInterval.value = wrkarr[6];
  392.         //AL_FCPrec.selectedIndex = parseInt(wrkarr[7],10);
  393.     }
  394.     else {
  395.         AL_FileAnd.checked = "";
  396.         AL_FileNot.checked = "";
  397.         AL_FileInterval.value = "";
  398.         //AL_FCPrec.selectedIndex = 0;
  399.     }
  400.     
  401.     AL_Suspend.checked = (pararr[3] == "1") ? "": "checked";    
  402.     AL_CCOneFileCheck.style.overflow = ( CountOfCompsRcvd > 9 ) ? "scroll" : "";
  403.     processPopulateCounterInputComplete();
  404. }
  405. function processFileCheckEdit() {
  406.     var LogSus = (AL_Suspend.checked) ? "0" :"1";
  407.     // Build fixed part of argument string
  408.     var pStrg = curAGRPID+"~"+LogSus+"~"+AL_FileCheckPath.value+"~"+AL_FileCheckString.value+"`"+AL_FileCheckSize.value;
  409.     pStrg += "`"+((AL_DeltaSize.checked)?"1":"0")+"`"+((AL_DeltaDT.checked)?"1":"0");
  410.     pStrg += "`"+((AL_FileAnd.checked)?"1":"0")+"`"+((AL_FileNot.checked)?"1":"0");
  411.     pStrg += "`"+AL_FileInterval.value+"`"+""; //AL_FCPrec.selectedIndex;
  412.  
  413.     // Append Computer IDs
  414.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  415.         pStrg += ";"+ELM_Ar[i];
  416.     }
  417.     if ( RpmCC_AL.FileCheckReplace(pStrg) ) { 
  418.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  419.         processResetButton();
  420.     }
  421.     else { // waiting for OperationCompleteEvent
  422.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  423.         processGeneralClick(CounterTab);
  424.     }
  425. }
  426. function processFCReplaceOpComplete(FCRStat) {
  427.     var wrkarr = new Array();
  428.     wrkarr = FCRStat.split(":"); // parse the lookup record
  429.     if ( wrkarr[0] == "Err" ) {
  430.         ALMode = ""; // reset mode
  431.         top.Rstatus.Pstat(FCRStat,true);
  432.         processResetButton(); // go reset
  433.     }
  434.     else {
  435.         ALMode = "";
  436.         finishEditComplete();
  437.     }
  438. }
  439.  
  440. function processFCDeleteOpComplete(FCDStat) {
  441. }
  442.  
  443. //------------------------------------------------------------------------------
  444. // Process Check Handling
  445. function processProcessCheckAdd() {
  446.     var LogSus = (AL_Suspend.checked) ? "0" :"1";    
  447.     // Substitute tilde in path if 
  448.     var sarr = new Array();
  449.     var warr = new Array();
  450.     sarr = AL_ProcessPath.value.split("~");
  451.     if ( sarr.length > 1 ) {
  452.         AL_ProcessPath.value = sarr.join("`");
  453.     }    
  454.     // Build fixed part of argument string    
  455.     var pStrg = curAGRPID+"~"+LogSus+"~"+AL_ProcessName.value+"~"+AL_ProcessPath.value+"~"+ProcCPUMax.value;
  456.     pStrg += "~"+ProcMemory.value+"~"+ProcPP.value+"~"+ProcNPP.value+"~"+ProcPF.value
  457.     pStrg += "~~"+((ProcRunningRadio[1].checked)?"1":"0")+"~"+((ProcNotifyOnly.checked)?"1":"0");
  458.     pStrg += "~"+((ProcTerminate.checked)?"1":"0")+"~"+((ProcRestart.checked)?"1":"0");
  459.     pStrg += "~"+ProcDuration.value+"[+]"+ProcInstanceCount.value; // Misc Parms
  460.     pStrg += "[+]"; // Misc Parms - Precedence
  461.     warr = ProcExclWildCard.value.split(";");
  462.     pStrg += "[+]"+warr.join(":"); // Misc Parms
  463.  
  464.     // Append Computer IDs
  465.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  466.         pStrg += ";"+ELM_Ar[i];
  467.     }
  468.     if ( RpmCC_AL.ProcessCheckAdd(pStrg) ) { 
  469.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  470.         processResetButton();
  471.     }
  472.     else { // waiting for OperationCompleteEvent
  473.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  474.         processGeneralClick(CounterTab);
  475.     }
  476. }
  477. function processPRCAddOpComplete(PCAStat) {
  478.     var wrkarr = new Array();
  479.     wrkarr = PCAStat.split(":"); // parse the lookup record
  480.     if ( wrkarr[0] == "Err" ) {
  481.         ALMode = ""; // reset mode
  482.         top.Rstatus.Pstat(PCAStat,true);
  483.         processResetButton(); // go reset
  484.         return;
  485.     }
  486.     ALupMode = "";
  487.     ALMode = ""; // reset mode
  488.     processAlLookupReset();
  489. }
  490. /* Initiate read for File Check Computers */
  491. function processPopulateProcessCheckComputers() {
  492.     if ( RpmCC_AL.ProcessCheckLookup(curAGRPID) ) {
  493.         ALupMode = "";
  494.         PINP_Bsy = false;
  495.         top.Rstatus.Pstat("Unable to start the Computer lookup request",true);
  496.     }
  497.     else {
  498.         CompIdLupArr = ""; // Computer Id Array
  499.         ALupMode = "PCComputerLookupPopIn"; // Mode
  500.         top.Rstatus.Pstat("One moment while Computer lookup request completes");
  501.     }
  502. }
  503. function processPRCLookupOpComplete(PCLStat) {
  504.     var wrkarr = new Array();
  505.     var pararr = new Array();
  506.     var miscarr = new Array();
  507.     wrkarr = PCLStat.split(":"); // parse the lookup record
  508.     if ( wrkarr[0] == "Err" ) {
  509.         ALMode = ""; // reset mode
  510.         top.Rstatus.Pstat(PCLStat,true);
  511.         processPopInError(); // go reset
  512.         return;
  513.     }
  514.     wrkarr = PCLStat.split(";"); // parse the lookup record
  515.     pararr = wrkarr[0].split("~"); // get Alert Group parameters
  516.     CompIdLupArr = wrkarr[1]; // get Computer ID array
  517.     wrkarr = CompIdLupArr.split(",");
  518.     CountOfCompsRcvd = wrkarr.length;
  519.     
  520.     var Max = 0;
  521.     AL_ProcessName.value = pararr[1];
  522.     var pp = pararr[2].split("`");
  523.     AL_ProcessPath.value = pp.join("~");;
  524.     Max = parseInt(pararr[4],10);
  525.     ProcCPUMax.value = (Max == 0)? "" : Max;
  526.     Max = parseInt(pararr[5],10);
  527.     ProcMemory.value = (Max == 0)? "" : Max;
  528.     Max = parseInt(pararr[6],10);
  529.     ProcPP.value = (Max == 0)? "" : Max;
  530.     Max = parseInt(pararr[7],10);
  531.     ProcNPP.value = (Max == 0)? "" : Max;
  532.     Max = parseInt(pararr[8],10);
  533.     ProcPF.value = (Max == 0)? "" : Max;
  534.     
  535.     if ( pararr[14] == ""  ) {
  536.         ProcDuration.value = "";
  537.         ProcInstanceCount.value = "";
  538.         ProcExclWildCard.value = "";
  539.     }
  540.     else {
  541.         miscarr = pararr[14].split("[+]");
  542.         ProcDuration.value = miscarr[0];
  543.         ProcInstanceCount.value = miscarr[1];
  544.         wrkarr.length = 0;
  545.         wrkarr = miscarr[3].split(":");
  546.         ProcExclWildCard.value = wrkarr.join(";");
  547.     }
  548.  
  549.     ProcRunningRadio[1].checked = (pararr[10] == "1") ? "checked" : "";
  550.     ProcNotifyOnly.checked = (pararr[11] == "1") ? "checked" : "";
  551.     ProcRestart.checked = (pararr[12] == "1") ? "checked" : "";
  552.     ProcTerminate.checked = (pararr[13] == "1") ? "checked" : "";
  553.     
  554.     AL_Suspend.checked = (pararr[3] == "1") ? "": "checked";    
  555.     AL_CCOneProcessCheck.style.overflow = ( CountOfCompsRcvd > 9 ) ? "scroll" : "";
  556.     processPopulateCounterInputComplete();
  557. }
  558. function processProcessCheckEdit() {
  559.     var LogSus = (AL_Suspend.checked) ? "0" :"1";
  560.     // Substitute tilde in path if 
  561.     var sarr = new Array();
  562.     sarr = AL_ProcessPath.value.split("~");
  563.     if ( sarr.length > 1 ) {
  564.         AL_ProcessPath.value = sarr.join("`");
  565.     }
  566.     // Build fixed part of argument string
  567.     var pStrg = curAGRPID+"~"+LogSus+"~"+AL_ProcessName.value+"~"+AL_ProcessPath.value+"~"+ProcCPUMax.value;
  568.     pStrg += "~"+ProcMemory.value+"~"+ProcPP.value+"~"+ProcNPP.value+"~"+ProcPF.value
  569.     pStrg += "~~"+((ProcRunningRadio[1].checked)?"1":"0")+"~"+((ProcNotifyOnly.checked)?"1":"0");
  570.     pStrg += "~"+((ProcTerminate.checked)?"1":"0")+"~"+((ProcRestart.checked)?"1":"0");
  571.     pStrg += "~"+ProcDuration.value+"[+]"+ProcInstanceCount.value; // Misc Parms
  572.     pStrg += "[+]"; // Misc Parms - Precedence
  573.     warr = ProcExclWildCard.value.split(";");
  574.     pStrg += "[+]"+warr.join(":"); // Misc Parms
  575.  
  576.     // Append Computer IDs
  577.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  578.         pStrg += ";"+ELM_Ar[i];
  579.     }
  580.     if ( RpmCC_AL.ProcessCheckReplace(pStrg) ) { 
  581.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  582.         processResetButton();
  583.     }
  584.     else { // waiting for OperationCompleteEvent
  585.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  586.         processGeneralClick(CounterTab);
  587.     }
  588. }
  589. function processPRCReplaceOpComplete(PCRStat) {
  590.     var wrkarr = new Array();
  591.     wrkarr = PCRStat.split(":"); // parse the lookup record
  592.     if ( wrkarr[0] == "Err" ) {
  593.         ALMode = ""; // reset mode
  594.         top.Rstatus.Pstat(PCRStat,true);
  595.         processResetButton(); // go reset
  596.     }
  597.     else {
  598.         ALMode = "";
  599.         finishEditComplete();
  600.     }
  601. }
  602.  
  603. function processPRCDeleteOpComplete(PCDStat) {
  604. }
  605.  
  606. function processProcRadio(Val) {
  607.     if ( Val == 1 ) {
  608.          ProcNotifyOnly.checked = "";
  609.      }
  610.     processProcNotify();
  611. }
  612.  
  613. function processProcNotify() {
  614.     ProcRestart.className = "idis";
  615.     ProcRestart.disabled = "disabled";
  616.     ProcRestart.checked = "";
  617.     ProcTerminate.className = "idis";
  618.     ProcTerminate.disabled = "disabled";
  619.     ProcTerminate.checked = "";
  620.     ProcRunningRadio[0].disabled = "";
  621.     ProcRunningRadio[1].disabled = "";
  622.     
  623.     if ( AL_ProcessName.value == "*" ) {
  624.             ProcTerminate.className = "";
  625.             ProcTerminate.disabled = "";
  626.             ProcTerminate.checked = "";  
  627.             ProcRunningRadio[1].checked = "checked"            
  628.             ProcRunningRadio[0].disabled = "disabled";
  629.             ProcRunningRadio[1].disabled = "disabled";
  630.     }
  631.     if ( !ProcNotifyOnly.checked ) {
  632.         if ( ProcRunningRadio[0].checked ) {
  633.             ProcRestart.className = "";
  634.             ProcRestart.disabled = "";
  635.             ProcRestart.checked = "checked";
  636.         }
  637.          else {
  638.             ProcTerminate.className = "";
  639.             ProcTerminate.disabled = "";
  640.             ProcTerminate.checked = "checked";
  641.         }
  642.     }
  643.     else {
  644.         if ( ProcRunningRadio[0].checked ) {
  645.             ProcRestart.className = "";
  646.             ProcRestart.disabled = "";
  647.             ProcRestart.checked = "";
  648.         }
  649.          else {
  650.             ProcTerminate.className = "";
  651.             ProcTerminate.disabled = "";
  652.             ProcTerminate.checked = "";
  653.         }
  654.     }    
  655. }
  656.  
  657. function procProcessEnumClick() {
  658.     if ( ALMode == "New" || ALMode == "Edit" ) {
  659.         FSFlag = 0;
  660.         SyslogText.innerText = "List Processes And Select";
  661.         FAC_Data.style.backgroundColor = "activeborder";
  662.         PopUpFAC.style.display = "";
  663.         var CCEs = "";
  664.          CCEs += "<br><table border='0' cellpadding='1' cellSpacing='0' width='230'>";
  665.           CCEs += "<tr><td width='100%' align='center' class='inputlabel'>Select a Server to View Its Current Running Processes</td></tr>";
  666.           CCEs += "<tr><td width='100%' align='center'><select id='EnumServers' onchange='processEnumServerSelect()' style='width:150'></select></td></tr>";
  667.         CCEs += "</table><br><br><br>";
  668.          CCEs += "<table border='0' cellpadding='1' cellSpacing='0' width='230'>";
  669.           CCEs += "<tr><td width='100%' align='center' class='inputlabel'>Select a Process to Set a Watch On</td></tr>";
  670.           CCEs += "<tr><td width='100%' align='center'><select id='EnumProcesses' style='width:150'></select></td></tr>";
  671.         CCEs += "</table>";
  672.     }
  673.     FAC_Data.innerHTML = CCEs;
  674.     Tid = setTimeout("procListServers()",10); // delay 
  675. }
  676. function procListServers() {
  677.     addElementToSelect(EnumServers,"Select a server...");
  678.     for ( var i=0, j=0; i<CompRecCount; ++i, j+=CompRecLength  ) {
  679.         addElementToSelect(EnumServers,AC_CompStoreArr[j+2]);
  680.     }
  681. }
  682.  
  683. var ServSelIndx = 0;
  684. function processEnumServerSelect() {
  685.     if (ServSelIndx != 0) {
  686.         EnumServers.selectedIndex = ServSelIndx;
  687.         return; //ignore
  688.     }
  689.     ServSelIndx = EnumServers.selectedIndex;
  690.     if ( ServSelIndx == 0 ) 
  691.        return;
  692.     var j = (ServSelIndx-1) * CompRecLength;
  693.     var strg = AC_CompStoreArr[j]+"~"+AC_CompStoreArr[j+2];
  694.       RpmCC_AL.NetStatFunction("EnumerateProcesses~"+strg);
  695.       EnumProcesses.innerHTML = "";
  696.       SetCursor("wait");
  697.     top.banner.processStartComm(); 
  698.     SetButtonState(FAC_OKButton,"1");
  699. }
  700. function getEnumProcesses(csarg) {
  701.       SetCursor("auto");
  702.     top.banner.processStopCommX();
  703.     SetButtonState(FAC_OKButton,"0");
  704.     ServSelIndx = 0;
  705.     var wrkarr = new Array();
  706.     wrkarr = csarg.split(";");
  707.     if ( wrkarr[1].substring(0,3) == "Err" ) {
  708.        alert("Cannot list processes from this server!\n\n"+wrkarr[1]+"\n\nPlease select another server.");
  709.        return;       
  710.     }
  711.     var entarr = new Array();
  712.     var entry = "";
  713.     for ( var i=0; i<wrkarr.length; i++ ) {
  714.         entry = wrkarr[i];
  715.         wrkarr[i] = entry.toLowerCase();   
  716.     }
  717.     wrkarr.sort();
  718.     var elObj = null;
  719.     for ( var i=0; i<wrkarr.length; i++ ) {
  720.         entarr.length = 0;
  721.         entarr = wrkarr[i].split("`");        
  722.          if ( entarr[0] == "enumprocesses" || entarr[0] == "unknown"  ) 
  723.             continue;
  724.         elObj = addElementToSelect(EnumProcesses,entarr[0]);  
  725.         elObj.value = entarr[1]; //save path 
  726.     }
  727. }
  728. function processProcParms1() {
  729.     ProcParms2.style.display = "none";
  730.     ProcParms1.style.display = "";
  731. }
  732. function processProcParms2() {
  733.     ProcParms1.style.display = "none";
  734.     ProcParms2.style.display = "";
  735. }
  736.  
  737. //------------------------------------------------------------------------
  738. /* Process Click on selected Tab */
  739. var CurSelTab = null; // current selected tab
  740. function processGeneralClick(th) {
  741.     if ( ALupMode != "" /*&& th.id != "CounterTab" */)
  742.         return;
  743.  
  744.     CounterUI.style.display="none";
  745.     SchedUI.style.display="none";
  746.     ActsUI.style.display="none";
  747.     CounterTab.className="TabUnsel";
  748.     SchedTab.className="TabUnsel";
  749.     ActsTab.className="TabUnsel";
  750.     th.className="TabSel";
  751.     if    (AL_AlertSel.style.display == "" && ALupMode == "") { 
  752.         AL_AlertSel.disabled = "";
  753.         if    (AL_AlertSel.style.visibility != "hidden") { 
  754.             AL_AlertSel.focus(); // default focus to Name field
  755.         }
  756.     }
  757.  
  758.     CurSelTab = th.id;
  759.     switch ( th.id ) {
  760.    case "CounterTab" : 
  761.      CounterUI.style.display=""; // Enable this Tab's view
  762.           if ( CurrentAT == CounterType ) { // Counter checked
  763.            if ( AL_Thrsh.className == "" ) {
  764.                    AL_Thrsh.focus(); // Set focus
  765.            }
  766.        }
  767.        else if ( CurrentAT == SNMPTrapType ) {
  768.             displayOIDChoices();
  769.        }
  770.         else if ( CurrentAT == SyslogCheckType ) {
  771.             displayFACObjectChoices(0); // display Facility & Severity
  772.             displayFACObjectChoices(1); 
  773.         }
  774.       break;
  775.    case "SchedTab" : 
  776.        SchedUI.style.display=""; // Enable this Tab's view
  777.        if ( AL_Sched.className == "" && AL_Sched.style.display != "") {
  778.            AL_Sched.focus(); // Set focus
  779.        }
  780.       break;
  781.    case "ActsTab" : 
  782.       ActsUI.style.display=""; // Enable this Tab's view
  783.       break;
  784.     }
  785. }
  786.  
  787. /* Process Click on Radio Button */
  788. function processTypeClick() {
  789.     if ( ALMode == "New" || ALMode == "Edit" ) {
  790.         fixupEveryTime();
  791.     }
  792.     var CImgObj = document.all["CTabI"];
  793.       if ( CurrentAT == ServiceType ) { // if Service checked
  794.           MaxAlertOption.style.display = "";
  795.           AL_SuspendText.style.display = "";
  796.           AL_Suspend.style.display = "";
  797.        //PLoc.style.display = "none";
  798.          CounterTab.innerHTML = '<img src="images/sAdminServers.gif" align="absmiddle" height="16" width="16"> IP Service';
  799.          ResetTypes();
  800.           servicetype.style.display=""; 
  801.           servicesched.style.display="";
  802.           if ( CheckEmailSubj() ) {
  803.             AL_ESubj.value = "MonitorIT ServerWatch Alert Notification"; // init Email Subj field
  804.         }
  805.       }
  806.       else if ( CurrentAT == EventLogType ) { // if Event Log checked
  807.           MaxAlertOption.style.display = "none";
  808.          AL_SuspendText.style.display = "";
  809.           AL_Suspend.style.display = "";
  810.        //PLoc.style.display = "none";
  811.          CounterTab.innerHTML = '<img src="images/sEventViewer.gif" align="absmiddle" height="16" width="16"> EVENTLog'; 
  812.         ResetTypes();
  813.           elogtype.style.display="";
  814.           elogsched.style.display="";
  815.           if ( CheckEmailSubj() ) {
  816.             AL_ESubj.value = "MonitorIT EventLogWatch Alert Notification"; // init Email Subj field
  817.         }
  818.       }
  819.       else if ( CurrentAT == SNMPTrapType ) { // if SNMP Trap checked
  820.           MaxAlertOption.style.display = "none";
  821.         AL_SuspendText.style.display = "";
  822.           AL_Suspend.style.display = "";
  823.        //PLoc.style.display = "none";
  824.          CounterTab.innerHTML = '<img src="images/SNMPTrapDisplaySm.gif" align="absmiddle" height="16" width="16"> SNMPTrap'; 
  825.         ResetTypes();
  826.           snmptrap_type.style.display="";
  827.           snmptrapsched.style.display="";
  828.           if ( CheckEmailSubj() ) {
  829.             AL_ESubj.value = "MonitorIT SNMPTrapWatch Alert Notification"; // init Email Subj field
  830.         }
  831.       }
  832.       else if ( CurrentAT == UserType ) { // if User checked
  833.           MaxAlertOption.style.display = "none";
  834.           AL_SuspendText.style.display = "none";
  835.           AL_Suspend.style.display = "none";
  836.        //PLoc.style.display = "none";
  837.          CounterTab.innerHTML = '<img src="images/monitoritalert.gif" align="absmiddle" height="16" width="16"> USER'; 
  838.          ResetTypes();
  839.           usertype.style.display=""; 
  840.           usersched.style.display=""; 
  841.           if ( CheckEmailSubj() ) {
  842.             AL_ESubj.value = "MonitorIT User Alert Notification"; // init Email Subj field
  843.         }
  844.       }
  845.       else if ( CurrentAT == WinServicesType ) { // if Windows Services checked
  846.           MaxAlertOption.style.display = "none";
  847.         AL_SuspendText.style.display = "";
  848.           AL_Suspend.style.display = "";
  849.        //PLoc.style.display = "none";
  850.          CounterTab.innerHTML = '<img src="images/WinServices.gif" align="absmiddle" height="18" width="18">SERVICE'; 
  851.          ResetTypes();
  852.           winservicestype.style.display="";
  853.           winservicessched.style.display="";
  854.           if ( CheckEmailSubj() ) {
  855.             AL_ESubj.value = "MonitorIT WinServicesWatch Alert Notification"; // init Email Subj field
  856.         }
  857.       }
  858.       else if ( CurrentAT == FileCheckType ) { // if File Check checked
  859.           MaxAlertOption.style.display = "none";
  860.          AL_SuspendText.style.display = "";
  861.           AL_Suspend.style.display = "";
  862.        //PLoc.style.display = "none";
  863.          CounterTab.innerHTML = '<img src="images/NewImg.gif" align="absmiddle" height="16" width="16"> FILE'; 
  864.         ResetTypes();
  865.           filechecktype.style.display="";
  866.           filechecktype.style.display="";
  867.           if ( CheckEmailSubj() ) {
  868.             AL_ESubj.value = "MonitorIT FileWatch Alert Notification"; // init Email Subj field
  869.         }
  870.       }
  871.    else if ( CurrentAT == ProcessCheckType ) { // if Process Check checked
  872.           MaxAlertOption.style.display = "none";
  873.          AL_SuspendText.style.display = "";
  874.           AL_Suspend.style.display = "";
  875.        //PLoc.style.display = "none";
  876.          CounterTab.innerHTML = '<img src="images/ProcessWatch.gif" align="absmiddle" height="16" width="16"> PROCESS'; 
  877.         ResetTypes();
  878.           processchecktype.style.display="";
  879.           processchecktype.style.display="";
  880.           if ( CheckEmailSubj() ) {
  881.             AL_ESubj.value = "MonitorIT ProcessWatch Alert Notification"; // init Email Subj field
  882.         }
  883.       }
  884.       else if ( CurrentAT == SyslogCheckType ) { // if Syslog Check checked
  885.           MaxAlertOption.style.display = "none";
  886.          AL_SuspendText.style.display = "";
  887.           AL_Suspend.style.display = "";
  888.        //PLoc.style.display = "none";
  889.          CounterTab.innerHTML = '<img src="images/SyslogDisplaySm.gif" align="absmiddle" height="16" width="16"> SYSLOG'; 
  890.          ResetTypes();
  891.           syslogchecktype.style.display="";
  892.           syslogchecktype.style.display="";
  893.           if ( CheckEmailSubj() ) {
  894.             AL_ESubj.value = "MonitorIT SYSLOGWatch Alert Notification"; // init Email Subj field
  895.         }
  896.       }
  897.       else {
  898.           MaxAlertOption.style.display = "";
  899.           AL_SuspendText.style.display = "none";
  900.           AL_Suspend.style.display = "none";
  901.         //PLoc.style.display = "";
  902.          CounterTab.innerHTML = '<img src="images/Objects.gif" align="absmiddle" height="16" width="16"> COUNTER'; 
  903.         ResetTypes();
  904.           countertype.style.display=""; 
  905.         countersched.style.display=""; 
  906.           if ( CheckEmailSubj() ) {
  907.             AL_ESubj.value = "MonitorIT CounterWatch Alert Notification"; // init Email Subj field
  908.         }
  909.       }
  910. function ResetTypes() {
  911.     servicetype.style.display="none"; 
  912.       countertype.style.display="none"; 
  913.       usertype.style.display="none";
  914.       elogtype.style.display="none";
  915.       snmptrap_type.style.display="none";
  916.     winservicestype.style.display="none"; 
  917.     filechecktype.style.display="none"; 
  918.     syslogchecktype.style.display="none"; 
  919.     processchecktype.style.display="none"; 
  920.     
  921.     servicesched.style.display="none";
  922.     countersched.style.display="none";
  923.     usersched.style.display="none";
  924.     elogsched.style.display="none";
  925.     snmptrapsched.style.display="none";
  926.     winservicessched.style.display="none"; 
  927.     syslogchecksched.style.display="none"; 
  928.     filechecksched.style.display="none"; 
  929.     processchecksched.style.display="none"; 
  930. }
  931. function CheckEmailSubj() {
  932.     if ( AL_ESubj.value == "MonitorIT CounterWatch Alert Notification" || AL_ESubj.value == "MonitorIT EventLogWatch Alert Notification" || AL_ESubj.value == "MonitorIT User Alert Notification" || AL_ESubj.value == "MonitorIT SNMPTrapWatch Alert Notification" || AL_ESubj.value == "MonitorIT ServerWatch Alert Notification" || AL_ESubj.value == "MonitorIT WinServicesWch Alert Notification"|| AL_ESubj.value == "MonitorIT SYSLOGWatch Alert Notification" || AL_ESubj.value == "MonitorIT FileWatch Alert Notification" || AL_ESubj.value == "MonitorIT ProcessWatch Alert Notification" || AL_ESubj.value == "" ) {
  933.         return true;
  934.     }
  935.     else {
  936.         return false;
  937.     }               
  938. }
  939.  
  940. /* Process New Button Click */
  941. function processNewButton() {
  942.     processSpecAT();
  943. }
  944. function processNewContinue() {
  945.     var wrk = new Array();
  946.     if ( PINP_Bsy == true ) 
  947.        return; // ignore
  948.     AL_Alert.value = ""; // clear Name field
  949.     AL_Desc.value = ""; // clear Description field
  950.     AL_Thrsh.value = ""; // clear Threshold field
  951.     AL_Dur.value = "0"; // init Duration field
  952.     AL_Sched.value = " 15 Min(s)"; // clear Schedule field
  953.     AL_SrvFreq.value = " 5 Min(s)"; // clear Service Frequency field
  954.     AL_MaxAlerts.value = "0"; // init Max Alerts Count field
  955.     AL_InactPer1.value = AL_InactPer1.value = "";
  956.     wrk = SmtpServerAddress.split("~"); 
  957.     AL_Smtp.value = wrk.join("; ");
  958.     AL_SrvcNme.value = "";
  959.     
  960.     AL_TUnder.checked = "";
  961.     AL_EveryT.checked = "checked";
  962.     AL_Suspend.checked = "";
  963.     AL_RunIt.checked = "";
  964.     AL_ENotify.checked = "";
  965.     AL_Phone.checked = "";
  966.     AL_Beeper.checked = "";
  967.  
  968.    AL_EvLogName.options[0].selected = "selected";     // Select log
  969.     AL_EvLogType.options[0].selected = "selected";     // Select type
  970.     AL_EvSrc.value =  "";
  971.     AL_EvCat.value = "";
  972.     AL_EvID.value = "";
  973.     AL_EvMsg.value = "";
  974.     AL_LogAnd.checked = "checked";
  975.     AL_LogExclude.checked = "";
  976.     AL_LogNot.checked = "";
  977.     AL_Suspend.checked = "";
  978.     AL_WSRestart.checked = "checked";
  979.     EmailText.value = "";
  980.     EmailTextDefined.style.display = "none";
  981.     
  982.     AL_FileCheckPath.value = "";
  983.     AL_FileCheckString.value = "";
  984.     AL_FileCheckSize.value = "";
  985.     AL_DeltaSize.checked = "";
  986.     AL_DeltaDT.checked = "";
  987.     AL_FileAnd.checked = "";
  988.     AL_FileNot.checked = "";
  989.     AL_FileInterval.value =  "";
  990.     
  991.     AL_MemCheck.value = "20";
  992.     AL_HDDCheck.value = "20";
  993.     
  994.     AL_ProcessPath.value = "";
  995.     AL_ProcessName.value = "";
  996.     ProcCPUMax.value = "";
  997.     ProcMemory.value = "";
  998.     ProcPP.value = "";
  999.     ProcNPP.value = "";
  1000.     ProcPF.value = "";
  1001.     ProcInstanceCount.value = "";
  1002.     ProcDuration.value = "";
  1003.     ProcExclWildCard.value = "";
  1004.     ProcNotifyOnly.checked = "";
  1005.     ProcRestart.checked = "checked";
  1006.     ProcTerminate.checked = "";
  1007.     ProcRunningRadio[0].checked = "checked";
  1008.  
  1009.     for ( var i=0; i<=FacilityMax; i++ ) {
  1010.        FACObjectCheckArr[i] = "0";       
  1011.     }    
  1012.     displayFACObjectChoices(0); // display them
  1013.     for ( var i=0; i<=SeverityMax; i++ ) {
  1014.        SEVObjectCheckArr[i] = "0";       
  1015.     }    
  1016.     displayFACObjectChoices(1); // display them
  1017.     AL_SLTag.value = "";
  1018.     AL_SLContent.value = "";
  1019.     AL_SLAnd.checked = "checked";
  1020.     
  1021.     // Initalize Suppress Monitoring parameters
  1022.     for ( var i=0; i<6; i++ ) {
  1023.        Suppress1[i] = Suppress2[i] = 0;
  1024.     }
  1025.     AL_InactPer1.value = "";
  1026.     AL_InactPer2.value = "";
  1027.  
  1028.     getTodayDate(); // get current D/T
  1029.     CDUnits = 1; CDCount = 15; // init Schedule values
  1030.     SrvUnits = 1; SrvCount = 5; // init Service Frequency Check values
  1031.     CurObjName = CurCntrName = ""; // Reset current Open Object and Counter
  1032.     curSrvcName = "PING"; // default to force expansion
  1033.     curAGRPID = null; // Reset curr Alert Grp ID
  1034.     CkCArr.length = 0; // reset Checked computer array
  1035.     LastCmpSelectedSuffix = null;
  1036.    CmpsSelectedCount = 0; // reset count
  1037.  
  1038.     AL_Dependency.value = ""; // preset
  1039.     AL_DependencySel.options[0].selected = "selected";
  1040.  
  1041.     ALMode = "New"; // Set Mode of operation
  1042.     commonNew_Edit(); // Do common processing
  1043.     AL_Alert.focus();
  1044. }            
  1045.  
  1046. /* Process Click on Edit Button */
  1047. function processEditButton() {
  1048.     if ( PINP_Bsy == true ) 
  1049.        return; // ignore
  1050.     ALMode = "Edit"; // Set Mode of operation
  1051.     commonNew_Edit(); // Do common processing
  1052. }    
  1053. function processDuplicateButton() {
  1054.     if ( PINP_Bsy == true ) 
  1055.        return; // ignore
  1056.     ALMode = "New"; // Set Mode of operation
  1057.     AL_Alert.value = ""; // clear Name field
  1058.     curAGRPID = null; // Reset curr Alert Grp ID
  1059.     CkCArr.length = 0; // reset Checked computer array
  1060.     LastCmpSelectedSuffix = null;
  1061.    CmpsSelectedCount = 0; // reset count
  1062.     DuplicateFlag = true;
  1063.     commonNew_Edit(); // Do common processing
  1064. }    
  1065.  
  1066. /* Process Expand and Collapse of the Services Tree and the Object:Counters Tree */
  1067. var AlertSelDisplayState = "";
  1068. var SeveritySelDisplayState = "";
  1069. var CCOneObjSave = null;
  1070. function processExpandButton(DisObj,ColObj) {
  1071.     if (     PopUpOID.style.display == "" ) {
  1072.         return; // ignore
  1073.     }
  1074.     AlertSelDisplayState = AL_AlertSel.style.display; // save state
  1075.     AL_AlertSel.style.display = "none";
  1076.     SeveritySelDisplayState = AL_WASeveritySel.style.display; // save state
  1077.     AL_WASeveritySel.style.display = "none";
  1078.     CCOneObjSave = DisObj; // save
  1079.     DisObj.className = "CCOneBoxExp";
  1080.     DisObj.style.height = CCOneExpH;
  1081.     DisObj.style.left = CCOneExpL;
  1082.     ColObj.style.top = CollapseButtonTop;
  1083.     ColObj.style.left = CollapseButtonLeft;
  1084.     ColObj.style.display = "";
  1085.     //CCExpandHdr.style.display = "";
  1086.       if ( CurrentAT == ServiceType || CurrentAT == EventLogType || CurrentAT == SNMPTrapType || 
  1087.              CurrentAT == SyslogCheckType || CurrentAT == FileCheckType || CurrentAT == ProcessCheckType ) { 
  1088.           bIPSelE.style.display = "";
  1089.           bIPUselE.style.display = "";
  1090.       }
  1091.       else {
  1092.           bIPSelE.style.display = "none";
  1093.           bIPUselE.style.display = "none";
  1094.       }
  1095.     if ( CurrentAT == EventLogType ) {
  1096.         AL_LogNameSel.style.display = "none";
  1097.         AL_LogTypeSel.style.display = "none";
  1098.         AL_ELPrec.style.display = "none";
  1099.     }
  1100.     else     if ( CurrentAT == SNMPTrapType ) {
  1101.         AL_OIDName.style.display = "none";
  1102.     }
  1103.     else if ( CurrentAT == SyslogCheckType ) {
  1104.         AL_SLFacility.style.display = "none";
  1105.         AL_SLSeverity.style.display = "none";
  1106.         AL_SLPrec.style.display = "none";
  1107.     }
  1108. }
  1109. function processCollapseButton() {
  1110.     AL_AlertSel.style.display = AlertSelDisplayState;
  1111.     AL_WASeveritySel.style.display = SeveritySelDisplayState;
  1112.     var DisObj = CCOneObjSave;
  1113.     DisObj.className = "CCOneBox";
  1114.     DisObj.style.height = CCOneBoxHeight;
  1115.     CollapseButton.style.display = "none";
  1116.     //CCExpandHdr.style.display = "none";
  1117.     if ( (ALMode == "Edit" || ALMode == "New") && CurrentAT == EventLogType ) {
  1118.         AL_LogNameSel.style.display = "";
  1119.         AL_LogTypeSel.style.display = "";
  1120.         AL_ELPrec.style.display = "";
  1121.     }
  1122.     if ( CurrentAT == SNMPTrapType ) {
  1123.         AL_OIDName.style.display = "";
  1124.     }
  1125.     else if ( CurrentAT == SyslogCheckType ) {
  1126.         AL_SLFacility.style.display = "";
  1127.         AL_SLSeverity.style.display = "";
  1128.         AL_SLPrec.style.display = "";
  1129.     }
  1130. }
  1131.  
  1132. function processSel(Pflg) {
  1133.     if ( CurrentAT == ServiceType )
  1134.         processIPSelect(Pflg);
  1135.     else
  1136.         processSelect(Pflg);
  1137. }
  1138.  
  1139. // Process SelectALL or UnselectALL
  1140. function processIPSelect(Pflg) {
  1141.     var EObj = null, CObj = null;
  1142.     EObj = document.all["sexp"+CurExpServIx];
  1143.     var compcount = EObj.compcount;
  1144.     // process each computer
  1145.     for ( var j=0; j<compcount; j++ ) {
  1146.         CObj = document.all["vima"+CurExpServIx+"_"+j]; // computer entry in tree
  1147.         if (CObj.checked == Pflg && CObj.inuse == "0") {
  1148.             procCmpImgClick(CObj); // go process
  1149.         }
  1150.     }
  1151. }
  1152.  
  1153. //Common processing for New and Edit
  1154. function commonNew_Edit() { 
  1155.     top.Rstatus.Pstat("");
  1156.     if ( ALMode == "New" || AGerr == true ) {
  1157.         document.RunPrgmRadio.AL_PLoc[0].checked = "checked";    
  1158.         document.RunPrgmRadio.AL_PLoc[1].checked = "";    
  1159.         document.RunPrgmRadio.AL_PLoc[2].checked = "";    
  1160.     }
  1161.     LastNewName = null;
  1162.     /* enable input fields */
  1163.     AL_Alert.className = "";
  1164.     AL_Desc.className = "";    
  1165.     AL_Thrsh.className = "";
  1166.     AL_Dur.className = "";
  1167.     AL_WASeverity.style.display = "none";
  1168.     AL_WASeveritySel.style.display = "";
  1169.     if ( ALMode == "New" ) {
  1170.         if ( CurrentAT == ServiceType ) {
  1171.             AL_WASeveritySel.selectedIndex = 2;
  1172.             AL_WASeverity.value = "Critical";
  1173.         }
  1174.         else {
  1175.             AL_WASeveritySel.selectedIndex = 1;
  1176.             AL_WASeverity.value = "Caution";
  1177.         }
  1178.     }
  1179.     SetButtonState(WatchReportButton,"1");    
  1180.     AL_EvSrc.className = "";
  1181.     AL_EvID.className = "";
  1182.     AL_EvCat.className = "";
  1183.     AL_EvMsg.className = "";
  1184.     AL_LogAnd.className = "";
  1185.     AL_LogAnd.disabled = "";
  1186.     AL_LogExclude.className = "";
  1187.     AL_LogExclude.disabled = "";
  1188.     AL_LogNot.className = "";
  1189.     AL_LogNot.disabled = "";
  1190.     AL_LogName.style.display = "none";
  1191.     AL_LogNameSel.style.display = "";
  1192.     AL_LogType.style.display = "none";
  1193.     AL_LogTypeSel.style.display = "";
  1194.     AL_ELPrec.className = "";
  1195.     AL_ELPrec.disabled = "";    
  1196.  
  1197.     AL_FileAnd.className = "";
  1198.     AL_FileAnd.disabled = "";
  1199.     AL_FileNot.className = "";
  1200.     AL_FileNot.disabled = "";
  1201.     //AL_FCPrec.className = "";
  1202.     //AL_FCPrec.disabled = "";
  1203.     AL_FileInterval.className = "";
  1204.     
  1205.     AL_FileCheckPath.className = "";
  1206.     AL_FileCheckString.className = "";
  1207.     AL_FileCheckSize.className = "";
  1208.     AL_FileCheckPath.disabled = "";
  1209.     AL_FileCheckString.disabled = "";
  1210.     AL_FileCheckSize.disabled = "";
  1211.     AL_DeltaSize.className = "";
  1212.     AL_DeltaSize.disabled = "";
  1213.     AL_DeltaDT.className = "";
  1214.     AL_DeltaDT.disabled = "";
  1215.  
  1216.     AL_MemCheck.className = "";
  1217.     AL_HDDCheck.className = "";
  1218.     AL_MemCheck.disabled = "";
  1219.     AL_HDDCheck.disabled = "";
  1220.  
  1221.     AL_ProcessPath.className = "";
  1222.     AL_ProcessName.className = "";
  1223.     ProcCPUMax.className = "";
  1224.     ProcMemory.className = "";
  1225.     ProcPP.className = "";
  1226.     ProcNPP.className = "";
  1227.     ProcPF.className = "";
  1228.     ProcInstanceCount.className = "";
  1229.     ProcDuration.className = "";
  1230.     ProcExclWildCard.className = "";
  1231.     AL_ProcessPath.disabled = "";
  1232.     AL_ProcessName.disabled = "";
  1233.     ProcCPUMax.disabled = "";
  1234.     ProcMemory.disabled = "";
  1235.     ProcPP.disabled = "";
  1236.     ProcNPP.disabled = "";
  1237.     ProcPF.disabled = "";
  1238.     
  1239.     ProcNotifyOnly.className = "";
  1240.     ProcNotifyOnly.disabled = "";
  1241.     PCEnumButton.style.visibility = "visible";
  1242.     ProcRunningRadio[0].disabled = "";
  1243.     ProcRunningRadio[0].className = "";
  1244.     ProcRunningRadio[1].disabled = "";
  1245.     ProcRunningRadio[1].className = "";
  1246.     processProcNotify();
  1247.  
  1248.     AL_SLFacility.className = "";
  1249.     AL_SLSeverity.className = "";
  1250.     AL_SLTag.className = "";
  1251.     AL_SLContent.className = "";
  1252.     AL_SLFacility.disabled = "";
  1253.     AL_SLSeverity.disabled = "";
  1254.     AL_SLTag.disabled = "";
  1255.     AL_SLContent.disabled = "";
  1256.     AL_SLAnd.className = "";
  1257.     AL_SLAnd.disabled = "";    
  1258.     AL_SLPrec.className = "";
  1259.     AL_SLPrec.disabled = "";    
  1260.     FACButton.style.visibility = "visible";
  1261.     SEVButton.style.visibility = "visible";
  1262.  
  1263.     AL_OIDName.className = "";
  1264.     OIDChoiceButton.style.display = "";
  1265.     
  1266.     document.WinSrvcRadio.AL_WinSrvcDisp[0].disabled = "";
  1267.     document.WinSrvcRadio.AL_WinSrvcDisp[1].disabled = "";
  1268.     document.WinSrvcRadio.AL_WinSrvcDisp[0].className = "";
  1269.     document.WinSrvcRadio.AL_WinSrvcDisp[1].className = "";
  1270.     AL_WSRestart.disabled = "";
  1271.     AL_WSRestart.className = "";
  1272.     WSTSelect.style.visibility = "visible";
  1273.     WinSrvcRadioDisplay.style.visibility = "visible";
  1274.     
  1275.     if ( AL_RunIt.checked ) {
  1276.         processPLocClick();
  1277.         document.RunPrgmRadio.AL_PLoc[0].disabled = "";
  1278.         document.RunPrgmRadio.AL_PLoc[1].disabled = "";
  1279.         document.RunPrgmRadio.AL_PLoc[2].disabled = "";
  1280.      }
  1281.     if ( AL_ENotify.checked ) {
  1282.         AL_EAddr.className = ""; 
  1283.         AL_ESubj.className = ""; 
  1284.     }
  1285.     if ( AL_Phone.checked ) {
  1286.         AL_AccessNbr.className = ""; 
  1287.         AL_PhoneNbr.className = ""; 
  1288.         AL_PagePswd.className = ""; 
  1289.         AL_TTSpeak.className = ""; 
  1290.     }
  1291.     if ( AL_Beeper.checked ) {
  1292.         AL_BeeperNbr.className = ""; 
  1293.         AL_TTSend.className = ""; 
  1294.     }
  1295.  
  1296.     AL_EveryT.className = "";
  1297.     AL_Suspend.className = "";
  1298.     AL_TUnder.className = "";
  1299.     AL_RunIt.className = "";
  1300.     AL_ENotify.className = "";
  1301.     AL_Phone.className = "";
  1302.     AL_Beeper.className = "";
  1303.  
  1304.      AL_EveryT.disabled = "";
  1305.     AL_Suspend.disabled = "";
  1306.     AL_TUnder.disabled = "";    
  1307.     AL_RunIt.disabled = ""; 
  1308.     AL_ENotify.disabled = ""; 
  1309.     AL_Phone.disabled = ""; 
  1310.     AL_Beeper.disabled = ""; 
  1311.  
  1312.     fixupEveryTime();
  1313.  
  1314.     AL_Dependency.style.display = "none";
  1315.     AL_DependencySel.style.display = "";
  1316.     
  1317.     AL_SrvFreq.style.cursor = "hand"; 
  1318.     AL_SrvFreq.className = "";
  1319.     AL_MaxAlerts.style.cursor = "hand"; 
  1320.     AL_MaxAlerts.className = "";
  1321.     AL_InactPer1.style.cursor = "hand"; 
  1322.     AL_InactPer1.className = "";
  1323.     AL_InactPer2.style.cursor = "hand"; 
  1324.     AL_InactPer2.className = "";
  1325.     AL_CWRestore.className = "";
  1326.     AL_CWRestore.disabled = "";
  1327.     
  1328.     CntrObNmeRow.style.visibility = "hidden";
  1329.     //SrvcNmeRow.style.visibility = "hidden";
  1330.     
  1331.     /* disable appropriate buttons */
  1332.     SetButtonState(UNewButton,"1");
  1333.     SetButtonState(UEditButton,"1");
  1334.     SetButtonState(UDupButton,"1");
  1335.     SetButtonState(UDeleteButton,"1");
  1336.  
  1337.     /* enable appropriate Alert Name fields */
  1338.     AL_Alert.style.display = "";
  1339.     AL_AlertSel.style.display = "none";
  1340.     
  1341.     /* format the Object:Counter:Computer box */
  1342.     AL_CCOne.style.backgroundColor = "white";
  1343.     AL_CCOne.style.height = CCOneBoxHeight;
  1344.     AL_CCOne.style.overflow = "scroll";
  1345.     AL_CCOne.innerHTML = ""; // clear display
  1346.  
  1347.     /* format the IP Services:Computer box */
  1348.     AL_CCOneServ.style.backgroundColor = "white";
  1349.     AL_CCOneServ.style.height = CCOneBoxHeight;
  1350.     AL_CCOneServ.style.overflow = "scroll";
  1351.     AL_CCOneServ.innerHTML = ""; // clear display
  1352.     bIPSelC.style.visibility = "visible";
  1353.     bIPUselC.style.visibility = "visible";
  1354.     bIPSelE.style.visibility = "visible";
  1355.     bIPUselE.style.visibility = "visible";
  1356.     
  1357.     /* format the Group:Computer box */
  1358.     AL_CCOneEventLog.style.backgroundColor = "white";
  1359.     AL_CCOneEventLog.style.height = CCOneBoxHeight;
  1360.     AL_CCOneEventLog.style.overflow = "scroll";
  1361.     AL_CCOneEventLog.innerHTML = ""; // clear display
  1362.     bELSelC.style.visibility = "visible";
  1363.     bELUselC.style.visibility = "visible";
  1364.  
  1365.     /* format the Win Services Computer box */
  1366.     AL_CCOneWinServ.style.backgroundColor = "white";
  1367.     AL_CCOneWinServ.style.height = CCOneBoxHeight;
  1368.     AL_CCOneWinServ.style.overflow = "scroll";
  1369.     AL_CCOneWinServ.innerHTML = ""; // clear display
  1370.  
  1371.     /* format the Object:Counter:Computer box */
  1372.     AL_CCOneSNMPTrap.style.backgroundColor = "white";
  1373.     AL_CCOneSNMPTrap.style.height = CCOneBoxHeight;
  1374.     AL_CCOneSNMPTrap.style.overflow = "scroll";
  1375.     AL_CCOneSNMPTrap.innerHTML = ""; // clear display
  1376.     bSTSelC.style.visibility = "visible";
  1377.     bSTUselC.style.visibility = "visible";
  1378.  
  1379.     /* format the File Check Computer box */
  1380.     AL_CCOneFileCheck.style.backgroundColor = "white";
  1381.     AL_CCOneFileCheck.style.height = CCOneBoxHeight;
  1382.     AL_CCOneFileCheck.style.overflow = "scroll";
  1383.     AL_CCOneFileCheck.innerHTML = ""; // clear display
  1384.     bFCSelC.style.visibility = "visible";
  1385.     bFCUselC.style.visibility = "visible";
  1386.  
  1387.     /* format the Process Check Computer box */
  1388.     AL_CCOneProcessCheck.style.backgroundColor = "white";
  1389.     AL_CCOneProcessCheck.style.height = CCOneBoxHeight;
  1390.     AL_CCOneProcessCheck.style.overflow = "scroll";
  1391.     AL_CCOneProcessCheck.innerHTML = ""; // clear display
  1392.     bPCSelC.style.visibility = "visible";
  1393.     bPCUselC.style.visibility = "visible";
  1394.  
  1395.     /* format the Syslog Check Computer box */
  1396.     AL_CCOneSyslogCheck.style.backgroundColor = "white";
  1397.     AL_CCOneSyslogCheck.style.height = CCOneBoxHeight;
  1398.     AL_CCOneSyslogCheck.style.overflow = "scroll";
  1399.     AL_CCOneSyslogCheck.innerHTML = ""; // clear display
  1400.     bSLSelC.style.visibility = "visible";
  1401.     bSLUselC.style.visibility = "visible";
  1402.     
  1403.     /* Select Counter Tab */
  1404.     processGeneralClick(CounterTab);
  1405.     // if NEW, create all Trees, if EDIT, only appropriate Tree
  1406.     if ( /*ALMode == "New" || */ CurrentAT == ServiceType ) {
  1407.         if ( AL_Alert.value == "" ) {
  1408.            AL_Alert.value = "ServerWatch-"
  1409.         }
  1410.         Tid = setTimeout("processServiceTree()",10); // delay 10 ms. then process Tree
  1411.     }
  1412.     else if ( CurrentAT == CounterType ) {
  1413.         if ( AL_Alert.value == "" ) {
  1414.            AL_Alert.value = "CounterWatch-"
  1415.         }
  1416.         Tid = setTimeout("processAATree()",10); // delay 10 ms. then process Tree
  1417.     }
  1418.     else if ( CurrentAT == EventLogType ) {
  1419.         if ( AL_Alert.value == "" ) {
  1420.            AL_Alert.value = "EventLogWatch-"
  1421.         }
  1422.         Tid = setTimeout("processELTree()",10); // delay 10 ms. then process Tree
  1423.     }
  1424.     else if ( CurrentAT == SNMPTrapType ) {
  1425.         if ( AL_Alert.value == "" ) {
  1426.            AL_Alert.value = "SnmpTrapWatch-"
  1427.         }
  1428.         Tid = setTimeout("processSNMPTrapTree()",10); // delay 10 ms. then process Tree
  1429.     }
  1430.     else if ( CurrentAT == FileCheckType ) {
  1431.         if ( AL_Alert.value == "" ) {
  1432.            AL_Alert.value = "FileWatch-"
  1433.         }
  1434.         Tid = setTimeout("processFileCheckTree()",10); // delay 10 ms. then process Tree
  1435.     }
  1436.     else if ( CurrentAT == ProcessCheckType ) {
  1437.         if ( AL_Alert.value == "" ) {
  1438.            AL_Alert.value = "ProcessWatch-"
  1439.         }
  1440.         Tid = setTimeout("processProcessCheckTree()",10); // delay 10 ms. then process Tree
  1441.     }
  1442.     else if ( CurrentAT == SyslogCheckType ) {
  1443.         if ( AL_Alert.value == "" ) {
  1444.            AL_Alert.value = "SyslogWatch-"
  1445.         }
  1446.         Tid = setTimeout("processSyslogCheckTree()",10); // delay 10 ms. then process Tree
  1447.     }
  1448.     else if ( CurrentAT == WinServicesType ) {
  1449.         if ( AL_Alert.value == "" ) {
  1450.            AL_Alert.value = "WinServiceWatch-"
  1451.         }
  1452.         Tid = setTimeout("processWinServicesTree()",10); // delay 10 ms. then process Tree
  1453.     }
  1454.     else { // User type
  1455.         if ( AL_Alert.value == "" ) {
  1456.            AL_Alert.value = "UserWatch-"
  1457.         }
  1458.         SetButtonState(UUpdateButton,"0");
  1459.         SetButtonState(UResetButton,"0");
  1460.     }
  1461. }
  1462. function fixupEveryTime() {
  1463.     AL_EveryT.className = "";
  1464.     AL_EveryT.disabled = "";
  1465.     // Disable Minimal Interval on those that do not support it
  1466.     /*
  1467.     if (CurrentAT == UserType || CurrentAT == FileCheckType || CurrentAT == WinServicesType || CurrentAT ==SNMPTrapType) { 
  1468.         AL_EveryT.checked = "checked";
  1469.         AL_EveryT.className = "idis";
  1470.          AL_EveryT.disabled = "disabled";
  1471.     }
  1472.     */
  1473.     if ( !AL_EveryT.checked ) {
  1474.         AL_Sched.style.cursor = "hand"; 
  1475.         AL_Sched.className = "";
  1476.     }
  1477.     else {
  1478.         AL_Sched.style.cursor = "auto"; 
  1479.         AL_Sched.className = "idis";
  1480.         AL_Sched.value = "";
  1481.     }
  1482. }
  1483.  
  1484. /* Process Click on the various Check Box parameters */
  1485. function processCheckBoxClick(th) {
  1486.     switch ( th.id ) {
  1487.    case "AL_EveryT" : 
  1488.         if (  SchedState == "1") { // if opened
  1489.            processSchedClick(); // close it
  1490.        }
  1491.         if ( !th.checked) {
  1492.             AL_Sched.style.cursor = "hand"; 
  1493.             AL_Sched.className = "";
  1494.             if ( AL_Sched.value == "" ) {
  1495.                 CDCount = 15; CDUnits = 1;
  1496.                 AL_Sched.value = " " + CDCount + " " + SchedTxtArray[CDUnits];
  1497.             }
  1498.         }
  1499.         else {
  1500.             AL_Sched.style.cursor = "auto"; 
  1501.             AL_Sched.className = "idis";
  1502.             AL_Sched.value = ""
  1503.         }
  1504.       break;
  1505.    case "AL_RunIt" : 
  1506.         if ( th.checked ) {
  1507.               if ( !document.RunPrgmRadio.AL_PLoc[2].checked ) {
  1508.                 AL_ExecP.className = ""; 
  1509.                  AL_ArgsP.className = ""; 
  1510.              }
  1511.               document.RunPrgmRadio.AL_PLoc[0].disabled = "";
  1512.               document.RunPrgmRadio.AL_PLoc[1].disabled = "";
  1513.               document.RunPrgmRadio.AL_PLoc[2].disabled = "";
  1514.         }
  1515.         else {
  1516.             AL_ExecP.className = "idis"; 
  1517.              AL_ArgsP.className = "idis"; 
  1518.               document.RunPrgmRadio.AL_PLoc[0].disabled = "disabled";
  1519.               document.RunPrgmRadio.AL_PLoc[1].disabled = "disabled";
  1520.               document.RunPrgmRadio.AL_PLoc[2].disabled = "disabled";
  1521.         }
  1522.       break;
  1523.    case "AL_ENotify" : 
  1524.         if ( th.checked ) {
  1525.             AL_EAddr.className = ""; 
  1526.             AL_ESubj.className = ""; 
  1527.             if ( AL_Smtp.value.length < 2 ) {
  1528.                 top.Rstatus.Pstat("Please define a Global SMTP Server",true);
  1529.                 alert("Please define a Global SMTP Server");
  1530.            }
  1531.         }
  1532.         else {
  1533.             AL_EAddr.className = "idis"; 
  1534.             AL_ESubj.className = "idis"; 
  1535.         }
  1536.       break;
  1537.    case "AL_Phone" : 
  1538.         if ( th.checked ) {
  1539.             AL_PhoneNbr.className = ""; 
  1540.              AL_AccessNbr.className = ""; 
  1541.             AL_PagePswd.className = ""; 
  1542.             AL_TTSpeak.className = ""; 
  1543.         }
  1544.         else {
  1545.             AL_PhoneNbr.className = "idis"; 
  1546.               AL_AccessNbr.className = "idis"; 
  1547.             AL_PagePswd.className = "idis"; 
  1548.             AL_TTSpeak.className = "idis"; 
  1549.         }
  1550.       break;
  1551.    case "AL_Beeper" : 
  1552.         if ( th.checked ) {
  1553.             AL_BeeperNbr.className = ""; 
  1554.              AL_TTSend.className = ""; 
  1555.         }
  1556.         else {
  1557.             AL_BeeperNbr.className = "idis"; 
  1558.              AL_TTSend.className = "idis"; 
  1559.         }
  1560.       break;
  1561.     }
  1562. }
  1563.  
  1564. /* Process Read of Counters; Format One line of Counter Output*/
  1565. function processEditCounter(CntrNme,CntrDesc,OA) {
  1566.     CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='490'>";
  1567.     linG = (LastObjectName == CurObjName) ? "White" : "I";
  1568.  
  1569.     CCEs += "<tr><td width='25'> </td><td width='19' height='20' align='center'><img src='images/" + linG + ".gif' width='19' height='20'></td>";
  1570.     if ( CntrNme == CurCntrName ) {
  1571.           CCEs += "<td width='19' height='20' align='center'><img id='cima" + CurObjIx + "_" + CurCntrIx;
  1572.           CCEs += "' expanded='1' src='images/Tminus.gif' style='cursor:hand' onclick='procCntrImgClick(this)' ocarray='";
  1573.           CCEs += OA + "' width='19' height='20'></td>";
  1574.         CurExpCntrIx = CurObjIx + "_" + CurCntrIx;
  1575.     }
  1576.     else {
  1577.           CCEs += "<td width='19' height='20' align='center'><img id='cima" + CurObjIx + "_" + CurCntrIx;
  1578.           CCEs += "' expanded='0' src='images/Tplus.gif' style='cursor:hand' onclick='procCntrImgClick(this)' ocarray='";
  1579.           CCEs += OA + "' width='19' height='20'></td>";
  1580.     }
  1581.     CCEs += "<td width='20' align='center'><img id='cimb" + CurObjIx + "_" + CurCntrIx + "' src='images/Counter.gif' style='cursor:hand' onclick='procCntrImgClick(this)' width='17' height='16' ";
  1582.     CCEs += 'title="'+ CntrDesc + '"></td>';
  1583.     CCEs += "<td width='*' class='optext'>" + CntrNme + "</td>";
  1584.     CCEs += "</tr></table>";
  1585.     CCEs += "<div id='cexp" + CurObjIx + "_" + CurCntrIx + "' compcount='0' compchkcount='0' cntrname='" + CntrNme + "'></div>";
  1586.     ++CurCntrIx; // bump index
  1587. }
  1588.  
  1589. /* Read of Counters complete; Output formatted Counters */
  1590. function processEditCounterComplete() {
  1591.     /* Find last refernece to "images/T" and change the "T" to an "L" */
  1592.     if ( CurCntrIx == 0 ) { // if no counters 
  1593.         ALupMode = "";
  1594.         top.Rstatus.Pstat("No Counters for this Object",true);
  1595.         SetCursor("auto");
  1596.           top.banner.processStopCommX();
  1597.         return;
  1598.     }
  1599.  
  1600.     lix = CCEs.lastIndexOf("images/T");
  1601.     CCEss = CCEs.substring(0,lix+7);
  1602.     CCEss += "L" + CCEs.substring(lix+8,CCEs.length);
  1603.     
  1604.     EObj = document.all["oexp"+CurObjIx];
  1605.     EObj.insertAdjacentHTML("beforeEnd",CCEss);
  1606.     EObj.style.display = "";
  1607.     EObj.cntrcount = CurCntrIx; // save count of counters
  1608.     refrCCOne = AL_CCOne.innerHTML; // refresh to elimninate blank line after expanded counters
  1609.     AL_CCOne.innerHTML = refrCCOne;
  1610.     document.all["oima"+CurObjIx].scrollIntoView(true);
  1611.     
  1612.     /* If a Counter is Expanded, Initiate Read for its Computers */
  1613.     if ( CurCntrName != "") {  // Expand Counter
  1614.         //* Lookup Computers for Counter Name 
  1615.         if ( RpmCC_AL.CounterLookupNameForCompIDArray(CurObjName,CurCntrName) ) {
  1616.             ALupMode = "";
  1617.             top.Rstatus.Pstat("Unable to start the Counter Name lookup request",true);
  1618.         }
  1619.         else {
  1620.             ALupMode = "CounterNameLookup";
  1621.             CurCntrName = "";
  1622.             top.Rstatus.Pstat("One moment while Counter Name lookup request completes");
  1623.         }
  1624.     }
  1625.     else {
  1626.         SetCursor("auto");
  1627.           top.banner.processStopCommX();
  1628.         ALupMode = "";
  1629.         top.Rstatus.Pstat("Request Completed");
  1630.     }
  1631. }
  1632.  
  1633. /* Process Click to Expand or Contract an Object */
  1634. function procObImgClick(OIm) {
  1635.     isx = OIm.id;  
  1636.     if ( isx.charAt(0) != "o" || ALupMode != "") // if not a "oimaxx"
  1637.                 return;
  1638.     isx = isx.substring(4,isx.length); // Strip off storage index
  1639.     cx = eval(isx); // Index for object
  1640.     var WrkArr = new Array(); // working array
  1641.     var OCWrkArr = new Array(); // working array
  1642.  
  1643.     CurObjIx = cx;
  1644.     CurObjName = AL_OCStoreArr[cx*ObjectRecLength]; //Object Expanded
  1645.     Oprfx = ( LastObjectName == CurObjName ) ? "L" : "T"; // Determine if last object
  1646.     
  1647.     OObj = document.all["oima"+CurObjIx];
  1648.     EObj = document.all["oexp"+CurObjIx];
  1649.  
  1650.     if ( OObj.expanded == "1" ) { // if currently expanded
  1651.         OObj.src = "images/" + Oprfx + "plus.gif";
  1652.        OObj.expanded = "0"; // Set contracted
  1653.         for ( var i=0; i<EObj.cntrcount; i++ ) { // Any computers selected under the Object?
  1654.            if ( document.all["cexp"+CurObjIx+"_"+i].compchkcount != 0 ) {
  1655.                LastCmpSelectedSuffix = null;
  1656.                CmpsSelectedCount = 0; // reset count
  1657.                break; // no need to look further
  1658.             }
  1659.         }
  1660.         EObj.style.display = "none";
  1661.         EObj.innerHTML = ""; // Contract 
  1662.     }
  1663.     else { // otherwise Expand
  1664.         OObj.src = "images/" + Oprfx + "minus.gif";
  1665.        OObj.expanded = "1"; // Set expanded
  1666.  
  1667.         /* Lookup Counter Name and Description */
  1668.         //CLOs = getObjIDArr(CurObjIx);
  1669.         var Wrk = new Array();
  1670.         var OCA = AL_OCStoreArr[(ObjectRecLength*CurObjIx)+2].split(";"); //ObjID,CmpID 
  1671.         Wrk = OCA[0].split(","); // get Object ID from pair of "ObjID,CompID"
  1672.  
  1673.         SetCursor("wait");
  1674.         top.banner.processStartComm();
  1675.         OE_ON = Wrk[0];
  1676.         Tid = setTimeout("processObjectExpand()",100); // delay 100 ms. then process 
  1677.     }
  1678. }
  1679. var OE_ON = "";
  1680. function processObjectExpand() {
  1681.     Tid = null;
  1682.     if ( RpmCC_AL.CounterLookupForObjCntrArray("ObjectID,"+OE_ON) ) {
  1683.         ALupMode = "";
  1684.         top.Rstatus.Pstat("Unable to start the Counter lookup request",true);
  1685.     }
  1686.      else {
  1687.         CCEs = ""; // initialize output string and counter
  1688.         CurCntrIx = 0; 
  1689.         ALupMode = "CounterLookupEdit"; // set Mode of operation
  1690.         top.Rstatus.Pstat("One moment while Counter lookup request completes");
  1691.     }
  1692. }
  1693.  
  1694. /* Process Click to Expand or Contract a Counter */
  1695. function procCntrImgClick(CIm) {
  1696.     isx = CIm.id;  
  1697.     if ( isx.charAt(0) != "c" || ALupMode != "") // if not a "cimaxx_xx"
  1698.                 return;
  1699.     var cx = isx.substring(4,isx.length); // Strip off index
  1700.  
  1701.     CurExpCntrIx = cx;
  1702.     lx = cx.lastIndexOf("_"); // derive the Object's Index
  1703.     var dx = eval( cx.substring(0,lx) );
  1704.     CurObjIx = dx; // Current Object Index
  1705.  
  1706.     CObj = document.all["cima"+cx];
  1707.     EObj = document.all["cexp"+cx];
  1708.     CurCntrIx = document.all["oexp"+dx].cntrcount; // Total Counter Count for this Obj
  1709.     LCIx = CurCntrIx-1; // Index to last Counter for assoc Obj
  1710.     Cpfx = (CurExpCntrIx == dx + "_" + LCIx) ? "L" : "T";
  1711.  
  1712.     if ( CObj.expanded == "1" ) { // if currently expanded
  1713.         CObj.src = "images/" + Cpfx + "plus.gif";
  1714.         EObj.style.display = "none";
  1715.         EObj.innerHTML = ""; // Contract 
  1716.        CObj.expanded = "0"; // Set contracted
  1717.        if (EObj.compchkcount != 0) { // Are computers checked?
  1718.            LastCmpSelectedSuffix = null;
  1719.            CmpsSelectedCount = 0; // reset count
  1720.        }
  1721.      }
  1722.     else { // otherwise Expand
  1723.         CObj.src = "images/" + Cpfx + "minus.gif";
  1724.        CObj.expanded = "1"; // Set expanded
  1725.          CurObjName = AL_OCStoreArr[(ObjectRecLength*dx)]; // Obj Name       
  1726.         //* Lookup Computers for Counter Name 
  1727.         SetCursor("wait");
  1728.         top.banner.processStartComm();
  1729.         CE_ON = CurObjName;
  1730.         CE_CN = EObj.cntrname;
  1731.         Tid = setTimeout("processCounterExpand()",100); // delay 100 ms. then process 
  1732.     }
  1733. }
  1734. var CE_ON = "";
  1735. var CE_CN = "";
  1736. function processCounterExpand() {
  1737.     Tid = null;
  1738.     if ( RpmCC_AL.CounterLookupNameForCompIDArray(CE_ON,CE_CN) ) {
  1739.         ALupMode = "";
  1740.         top.Rstatus.Pstat("Unable to start the Counter Name lookup request",true);
  1741.     }
  1742.     else {
  1743.         ALupMode = "CounterNameLookup";
  1744.         top.Rstatus.Pstat("One moment while Counter Name lookup request completes");
  1745.     }
  1746. }
  1747.  
  1748. /* Process Click to Check or Uncheck a Computer */
  1749. function procCmpImgClick(CmpIm) {
  1750.     isx = CmpIm.id;  
  1751.     if ( isx.charAt(0) != "p" && isx.charAt(0) != "v") // if not a "pimaxx_xx_yy" or "vimaxx_yy"
  1752.                 return;
  1753.     var cx = isx.substring(4,isx.length); // Strip off index
  1754.     lx = cx.lastIndexOf("_"); // derive suffix to the Counter/Service DIV ID
  1755.     var dx = cx.substring(0,lx);
  1756.     
  1757.     var dp = "c"; var cp = "p"; var mp = "Counter"; // preset prefixes 
  1758.       if ( CurrentAT == ServiceType ) { // if Service checked
  1759.         dp = "s"; cp = "v"; mp = "Service";
  1760.     }    
  1761.     DObj = document.all[dp+"exp"+dx]; // DIV for Computer Expansion
  1762.     CObj = document.all[cp+"ima"+cx]; // Clicked Computer Entry
  1763.     var IObj = document.all["pimb"+cx]; // Clicked Computer Image Entry
  1764.     
  1765.     if ( CObj.checked == "1" ) { // if currently Checked, Uncheck
  1766.         CObj.src = "images/Unchecked.gif";
  1767.         IObj.src = "images/Computer.gif";
  1768.        CObj.checked = "0"; // Set Unchecked
  1769.        --DObj.compchkcount; // decrement count of computers checked
  1770.        --CmpsSelectedCount;
  1771.    }
  1772.     else { // otherwise Check
  1773.        if ( DObj.compchkcount == 0 ) { // If no computers yet checked
  1774.            if ( CmpsSelectedCount > 0 ) { // If some computers selected elsewhere
  1775.                 if ( confirm("Only one "+mp+", and the associated Servers/Devices, per Watch/Alert can be defined. You have Servers/Devices selected for another "+mp+"!\n Press OK to unselect those Servers/Devices and select this one.\n Press CANCEL to keep those Servers/Devices and ignore this selection.") ) {
  1776.                     goResetSelectedComps(dp,cp); // Go reset those computers
  1777.                 }
  1778.                 else {
  1779.                     return;
  1780.                 }           
  1781.            }
  1782.        }
  1783.         CObj.src = "images/Checked.gif";
  1784.         IObj.src = "images/"+selectImage;
  1785.        CObj.checked = "1"; // Set Checked
  1786.        LastCmpSelectedSuffix = dx; // Save suffix
  1787.           ++DObj.compchkcount; // increment count of computers checked
  1788.        ++CmpsSelectedCount;
  1789.     }
  1790. }
  1791.  
  1792. /* Create Counter Array for Add or Replace Based on Selected Computers */
  1793. function createCounterIDArray() {
  1794.     var OCntrArr = new Array(); // ObjectID,CounterID Array
  1795.     var OCmpArr = new Array(); // ObjectID,ComputerID Array
  1796.     var Wrk0 = new Array();
  1797.     var Wrk1 = new Array();
  1798.  
  1799.     AAid = ""; // default no computers selected
  1800.     OCArray.length = 0; // init for CompID,ObjID,CntrID array for updating the Store
  1801.     var cx = LastCmpSelectedSuffix;
  1802.     if (cx == null) {
  1803.         return false;
  1804.     }
  1805.     /* Create an array of selected computers */
  1806.     CXObj = document.all["cexp"+cx]; // DIV object for Computer expansion
  1807.     CkCArr.length = 0; // Reset Checked computer array
  1808.     for ( var i=0, j=0; i<CXObj.compcount; i++ ) { // Test each computer for Checked
  1809.         if ( document.all["pima"+cx+"_"+i].checked == "1" ) {
  1810.             CkCArr[j++] = document.all["pima"+cx+"_"+i].compid; // save Computer ID
  1811.         }
  1812.     }
  1813.     /* Get Array of ObjID,CntrID pairs for the selected Counter */
  1814.     OCntrArr = document.all["cima"+cx].ocarray.split(";"); //ObjID,CntrID Pairs    
  1815.  
  1816.     /* Get Array of ObjID,ComputerID pairs from Object store for the selected Object */
  1817.     lxi = cx.lastIndexOf("_"); // derive suffix to the Object's index
  1818.     dxi = eval( cx.substring(0,lxi) );
  1819.     OCmpArr = AL_OCStoreArr[(ObjectRecLength*dxi)+2].split(";"); //ObjID,CmpID Pairs
  1820.  
  1821.     /* Find CounterID for each Computer in CheckedComputer Array */
  1822.     oclth = OCmpArr.length-1;
  1823.     ocntlth = OCntrArr.length-1;
  1824.  
  1825.     AIix = 0; // initialize Counter Array index
  1826.     for ( i=0; i<CkCArr.length; i++ ) { // For each selected computer
  1827.         for ( j=0; j<oclth; j++ ) { // Look for match on ComputerID with ObjID
  1828.             Wrk0 = OCmpArr[j].split(","); // Get ObjID and CmpID
  1829.             if ( CkCArr[i] == Wrk0[1] ) { // Match on CompID?
  1830.                 for ( var k=0; k<ocntlth; k++ ) {
  1831.                     Wrk1 = OCntrArr[k].split(","); // Get ObjID and CntrID
  1832.                    if ( Wrk0[0] == Wrk1[0] ) { // Match on ObjID?
  1833.                            // Increment the CounterID array
  1834.                            if ( AIix > 0) {
  1835.                                AAid += ";"; // array id separator
  1836.                             }
  1837.                              Wrk0 = Wrk1[0].split("-"); // get Instance ID
  1838.                             AAid += Wrk1[1] + "," + Wrk0[1]; // Add CounterID,InstanceID
  1839.                              ++AIix; // bump count/index
  1840.                              // Increment the CompID,ObjectID,CntrID array
  1841.                              OCArray += CkCArr[i]+","+Wrk1[0]+","+Wrk1[1];
  1842.                              OCArray += ";"; // triplet id separator
  1843.                              break;
  1844.                      } // If match on ObjID
  1845.                  } // Look For match on ObjID with CounterID
  1846.                  break;
  1847.              } // If Match on CompID
  1848.          } // Look for match on ComputerID with ObjID
  1849.    } // For each selected Computer
  1850.  
  1851.    return true;
  1852. }
  1853.  
  1854. /* Process Click on Update Button */
  1855. function processUpdateButton() {
  1856.     var warr = new Array();
  1857.     closeCalendarTimeFields(); // make sure closed
  1858.     /* get input and insure required input is entered */
  1859.     ANme = AL_Alert.value;
  1860.     if (ANme.length == 0) { // if no name entered
  1861.         top.Rstatus.Pstat("Please enter a Watch/Alert Name",true);    
  1862.         alert("Please enter a Watch/Alert Name");    
  1863.         AL_Alert.focus();
  1864.         return;
  1865.     }
  1866.     ADsc = AL_Desc.value;
  1867.     AEvt = (AL_EveryT.checked) ? "1" : "0";
  1868.  
  1869.     // If Counter Selected, check its parameters
  1870.       if ( CurrentAT == CounterType ) { // if Counter checked
  1871.           if ( AEvt == "1" ) { // if Everytime is set, set Schedule to 1 sec
  1872.             CDUnits = 0; 
  1873.             CDCount = 1; 
  1874.         }
  1875.         AThr = AL_Thrsh.value;
  1876.         if (AThr.length == 0) { // if no threshold entered
  1877.             top.Rstatus.Pstat("Please enter an Alert Threshold",true);    
  1878.             alert("Please enter an Alert Threshold");    
  1879.             processGeneralClick(CounterTab);
  1880.             return;
  1881.         }
  1882.         AUnd = (AL_TUnder.checked) ? "1" : "0";
  1883.         ADur = AL_Dur.value;
  1884.  
  1885.         if ( AL_Suspend.checked ) {
  1886.             ASdt = "01/01/1999 11:59:00"; // clear Start and Stop D/T
  1887.             AEdt = "01/01/1999 12:00:00"; 
  1888.         }
  1889.         else {
  1890.             ASdt = "01/01/2000 0:0:0"; // default Start and Stop D/T
  1891.             AEdt = "12/31/2030 23:59:59"; 
  1892.         }
  1893.         // Create Counter ID Array from Selected Computers 
  1894.         var ccaStat = createCounterIDArray();
  1895.         if ( ccaStat == false ) {
  1896.             top.Rstatus.Pstat("Please select at least one Computer for the Watch/Alert",true);    
  1897.             alert("Please select at least one Computer for the Wathc/Alert");    
  1898.             processGeneralClick(CounterTab);
  1899.             return;
  1900.         }
  1901.         if ( AAid == "" ) {
  1902.             top.Rstatus.Pstat("Refresh Configure Watches/Alerts page; Inventory has changed",true);    
  1903.             alert("Refresh Configure Watches/Alerts page; Inventory has changed");    
  1904.             processGeneralClick(CounterTab);
  1905.             return;
  1906.         }
  1907.         // Get Alert Schedule Information 
  1908.         if ( AEvt == "0" && AL_Sched.value.length == 0) {
  1909.             top.Rstatus.Pstat("Please select a Minimal Notification Interval",true);    
  1910.             alert("Please select a Minimal Notification Interval");    
  1911.             processGeneralClick(SchedTab);
  1912.             return;
  1913.         }
  1914.         ADsc = ADsc+"[]"+"]["+"]["+"]["+MaxAlertsCount+"]["+((AL_CWRestore.checked)?"1":"0")+"]["+AL_WASeveritySel.selectedIndex;
  1915.     }
  1916.     else if ( CurrentAT == UserType ) { // if User checked
  1917.         AAid = "";
  1918.         AThr = AUnd = ADur = "0";
  1919.         ASdt = "01/01/1999 11:50:00"; // clear Start and Stop D/T
  1920.         AEdt = "01/01/1999 12:00:00"; 
  1921.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  1922.     }
  1923.     else if ( CurrentAT == SNMPTrapType ) { // if SNMP Trap checked
  1924.         AAid = "";
  1925.         AThr = AUnd = ADur = "0";
  1926.         ASdt = "01/01/1999 11:20:00"; // clear Start and Stop D/T
  1927.         AEdt = "01/01/1999 12:00:00"; 
  1928.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  1929.         if ( !createSNMPTrapArray() ) { // Get array of OIDs
  1930.             top.Rstatus.Pstat("Please select at least one OID for the SNMP Trap Watch",true);    
  1931.             alert("Please select at least one OID for the SNMP Trap Watch");    
  1932.             processGeneralClick(CounterTab);
  1933.             return;
  1934.         }
  1935.         if ( !createElmArray() ) {
  1936.             top.Rstatus.Pstat("Please select at least one Server/Device for the SNMP Trap Watch",true);    
  1937.             alert("Please select at least one Server/Device for the SNMP Trap Watch");    
  1938.             processGeneralClick(CounterTab);
  1939.             return;
  1940.         }
  1941.     }
  1942.     else if ( CurrentAT == EventLogType ) { // if Event Log checked
  1943.         AAid = "";
  1944.         AThr = AUnd = ADur = "0";
  1945.         ASdt = "01/01/1999 11:40:00"; // clear Start and Stop D/T
  1946.         AEdt = "01/01/1999 12:00:00"; 
  1947.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  1948.         // Create Array of Selected Computers 
  1949.         if ( !createElmArray() ) {
  1950.             top.Rstatus.Pstat("Please select at least one Server for the Event Log Monitoring",true);    
  1951.             alert("Please select at least one Server for the Event Log Monitoring");    
  1952.             processGeneralClick(CounterTab);
  1953.             return;
  1954.         }
  1955.         if ( AL_EvID.value != "" ) {
  1956.             if ( isNaN( parseInt(AL_EvID.value,10) ) ) {
  1957.                 top.Rstatus.Pstat("The Event ID must be a number. Please reenter",true);    
  1958.                 alert("The Event ID must be a number. Please reenter");    
  1959.                 processGeneralClick(CounterTab);
  1960.                 return;
  1961.             }
  1962.         }
  1963.     }
  1964.     else if ( CurrentAT == WinServicesType ) { // if Windows Services checked
  1965.         AAid = "";
  1966.         AThr = AUnd = ADur = "0";
  1967.         ASdt = "01/01/1999 11:10:00"; // clear Start and Stop D/T
  1968.         AEdt = "01/01/1999 12:00:00"; 
  1969.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  1970.         // Create Array of Selected Computers 
  1971.         if ( !getCheckedSrvcsArray() ) {
  1972.             top.Rstatus.Pstat("Please select at least one Service for one Server for the Services Monitoring",true);    
  1973.             alert("Please select at least one Service for one Server for the Services Monitoring");    
  1974.             processGeneralClick(CounterTab);
  1975.             return;
  1976.         }
  1977.     }
  1978.     else if ( CurrentAT == FileCheckType ) { // if File Check checked
  1979.         AAid = "";
  1980.         AThr = AUnd = ADur = "0";
  1981.         ASdt = "01/01/1999 11:00:00"; // clear Start and Stop D/T
  1982.         AEdt = "01/01/1999 12:00:00"; 
  1983.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  1984.         if ( AL_FileCheckPath.value == "" ) {
  1985.             top.Rstatus.Pstat("Please specify a Path & File name to watch for",true);    
  1986.             alert("Please specify a Path & File name to watch for");    
  1987.             processGeneralClick(CounterTab);
  1988.             return;  
  1989.         }
  1990.         if ( !createElmArray() ) {
  1991.             top.Rstatus.Pstat("Please select at least one Server for the FileWatch Monitoring",true);    
  1992.             alert("Please select at least one Server for the FileWatch Monitoring");    
  1993.             processGeneralClick(CounterTab);
  1994.             return;
  1995.         }
  1996.     }
  1997.     else if ( CurrentAT == ProcessCheckType ) { // if File Check checked
  1998.         AAid = "";
  1999.         AThr = AUnd = ADur = "0";
  2000.         ASdt = "01/01/1999 11:12:00"; // clear Start and Stop D/T
  2001.         AEdt = "01/01/1999 12:00:00"; 
  2002.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  2003.         if ( AL_ProcessName.value == "" ) {
  2004.             top.Rstatus.Pstat("Please specify a Process name to watch for",true);    
  2005.             alert("Please specify a Process name to watch for");    
  2006.             processGeneralClick(CounterTab);
  2007.             return;  
  2008.         }
  2009.         if ( AL_ProcessPath.value == "" && ProcRestart.checked && ProcRunningRadio[0].checked ) {
  2010.             top.Rstatus.Pstat("Please specify a fully-qualified path and exceutable name for restarting the Process",true);    
  2011.             alert("Please specify a fully-qualified path and exceutable name for restarting the Process");    
  2012.             processGeneralClick(CounterTab);
  2013.             AL_ProcessPath.focus();
  2014.             return;  
  2015.         }
  2016.         if ( !createElmArray() ) {
  2017.             top.Rstatus.Pstat("Please select at least one Server for the ProcessWatch Monitoring",true);    
  2018.             alert("Please select at least one Server for the ProcessWatch Monitoring");    
  2019.             processGeneralClick(CounterTab);
  2020.             return;
  2021.         }
  2022.     }
  2023.     else if ( CurrentAT == SyslogCheckType ) { // if Syslog Check checked
  2024.         AAid = "";
  2025.         AThr = AUnd = ADur = "0";
  2026.         ASdt = "01/01/1999 11:15:00"; // clear Start and Stop D/T
  2027.         AEdt = "01/01/1999 12:00:00"; 
  2028.         ADsc = ADsc+"[]"+"]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  2029.         if ( GetSelectedFacilities() == "" && GetSelectedSeverities() == "" ) {
  2030.             top.Rstatus.Pstat("Please specify at least one Facility parameter or one Severity parameter",true);    
  2031.             alert("Please specify at least one Facility parameter or one Severity parameter");    
  2032.             processGeneralClick(CounterTab);
  2033.             return;  
  2034.         }
  2035.         if ( !createElmArray() ) {
  2036.             top.Rstatus.Pstat("Please select at least one Server/Device for the SyslogWatch Monitoring",true);    
  2037.             alert("Please select at least one Server/Device for the SyslogWatch Monitoring");    
  2038.             processGeneralClick(CounterTab);
  2039.             return;
  2040.         }
  2041.     }
  2042.     // otherwise, get Services parameters
  2043.     else {
  2044.         AUnd = "";
  2045.         ADur = "";
  2046.         AThr = MaxAlertsCount;
  2047.         ASdt = "01/01/1999 11:30:00"; // clear Start and Stop D/T
  2048.         AEdt = "01/01/1999 12:00:00"; 
  2049.         // Create Service Array of Selected Computers 
  2050.         var scaStat = createServiceIDArray();
  2051.         AAid = ""; // clear 
  2052.         if ( scaStat == false ) {
  2053.             top.Rstatus.Pstat("Please select at least one Server/Device for the Service",true);    
  2054.             alert("Please select at least one Server/Device for the Service");    
  2055.             processGeneralClick(CounterTab);
  2056.             return;
  2057.         }
  2058.         // Get Alert Dependency Info if any
  2059.         DependencyID = ""; // initailize
  2060.         if ( AL_DependencySel.selectedIndex != 0 ) {
  2061.             var UNM = AL_DependencySel.options[AL_DependencySel.selectedIndex].text;
  2062.             for (var i=0, j=0; i < AlertStoreArr.length; ++j, i+=AlertRecLength) {
  2063.                 if ( AlertStoreArr[i] == UNM ) {
  2064.                     DependencyID = AlertStoreArr[i+1];
  2065.                     break;
  2066.                 }
  2067.             }
  2068.         }
  2069.           if ( SuppressMonitoringState == "1") { // if open
  2070.             processInactivePeriodsClick(); // close & get values
  2071.         }
  2072.         // Get Supress Monitor Info if any
  2073.         ADsc = ADsc+"[]"+DependencyID+"]["+Suppress1.join("^")+"]["+Suppress2.join("^")+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  2074.     }
  2075.     
  2076.     // Get Alert Schedule Information 
  2077.     if ( AEvt == "0" && AL_Sched.value.length == 0) {
  2078.         top.Rstatus.Pstat("Please select a Minimal Notification Interval",true);    
  2079.         alert("Please select a Minimal Notification Interval");    
  2080.         processGeneralClick(SchedTab);
  2081.         return;
  2082.     }
  2083.       if ( CurrentAT == CounterType ) { // if Counter checked
  2084.           AEvt = "1"; // insure EveryTime is always set
  2085.       }
  2086.      ASch = "0,0," + CDUnits + "," + CDCount;
  2087.  
  2088.     // Get Alert Action Information 
  2089.     ARit = (AL_RunIt.checked) ? "1" : "0";
  2090.     AEp = AL_ExecP.value;
  2091.     if ( document.RunPrgmRadio.AL_PLoc[1].checked ) { // if Remote checked
  2092.         AEp = ">"+AEp;
  2093.     }
  2094.     else if ( document.RunPrgmRadio.AL_PLoc[2].checked ) { // if Remote Reboot checked
  2095.         AEp = '>"RESTART"';
  2096.     }
  2097.     if ( ARit == "1" && AEp.length == 0) {
  2098.         top.Rstatus.Pstat("Please select a Name of Program to Run on Alert Action",true);    
  2099.         alert("Please select a Name of Program to Run on Alert Action");    
  2100.         processGeneralClick(ActsTab);
  2101.         processRunPSetup();
  2102.         return;
  2103.     }
  2104.     AArg = AL_ArgsP.value;
  2105.     
  2106.     AEno = (AL_ENotify.checked) ? "1" : "0";
  2107.     
  2108.     warr = AL_EAddr.value.split(";");
  2109.     AEad = AL_EAddr.value = warr.join(",");
  2110.     if ( AEno == "1" && AEad.length == 0) {
  2111.         top.Rstatus.Pstat("Please select an Email Address for Alert Action",true);    
  2112.         alert("Please select an Email Address for Alert Action");    
  2113.         processGeneralClick(ActsTab);
  2114.         processEmailSetup();
  2115.         AL_EAddr.focus();
  2116.         return;
  2117.     }
  2118.     if ( AEad.indexOf(";") >= 0 ) {
  2119.           top.Rstatus.Pstat("Please separate Email Addresses with a comma. Semi-colons are not allowed",true);    
  2120.           alert("Please separate Email Addresses with a comma. Semi-colons are not allowed");    
  2121.         processGeneralClick(ActsTab);
  2122.         processEmailSetup();
  2123.         AL_EAddr.focus();
  2124.         return;
  2125.     }
  2126.     if ( AEno == "1" && AL_Smtp.value.length < 2) {
  2127.         top.Rstatus.Pstat("Please define the Global SMTP Server address",true);    
  2128.         alert("Please define the Global SMTP Server address");    
  2129.         processGeneralClick(ActsTab);
  2130.         processEmailSetup();
  2131.         return;
  2132.     }
  2133.     AEs = (AL_ESubj.value.length == 0) ? "MonitorIT Alert Notification" : AL_ESubj.value;
  2134.     var warrft = new Array();
  2135.     warrft = EmailText.value.split("\x0a");
  2136.     AEs += "[+]"+ warrft.join("");
  2137.     
  2138.     APhn = (AL_Phone.checked) ? "1" : "0";
  2139.     var warrAN = new Array();
  2140.     warrAN = AL_AccessNbr.value.split(";");
  2141.     APhnb = warrAN.join("[+]");
  2142.     if ( APhn == "1" && APhnb.length == 0) {
  2143.         top.Rstatus.Pstat("Please specify a Pager Access number",true);    
  2144.         alert("Please specify a Pager Access number");    
  2145.         processGeneralClick(ActsTab);
  2146.         processPagerSetup();
  2147.         AL_AccessNbr.focus();
  2148.         return;
  2149.     }
  2150.     ATtk = AL_TTSpeak.value;
  2151.     if ( APhn == "1" && ATtk.length == 0) {
  2152.         top.Rstatus.Pstat("Please specify some Text-To-Send",true);    
  2153.         alert("Please specify some Text-To-Send");    
  2154.         processGeneralClick(ActsTab);
  2155.         processPagerSetup();
  2156.         AL_TTSpeak.focus();
  2157.         return;
  2158.     }
  2159.     
  2160.     APg = (AL_Beeper.checked) ? "1" : "0";
  2161.     APgnb = AL_BeeperNbr.value;
  2162.     if ( APg == "1" && APgnb.length == 0) {
  2163.         top.Rstatus.Pstat("Please specify a Beeper number",true);    
  2164.         alert("Please specify a Beeper number");    
  2165.         processGeneralClick(ActsTab);
  2166.         processBeeperSetup();
  2167.         AL_BeeperNbr.focus();
  2168.         return;
  2169.     }
  2170.     ATtn = AL_TTSend.value;
  2171.     if ( APg == "1" && ATtn.length == 0) {
  2172.         top.Rstatus.Pstat("Please specify some Numeric Text-To-Send",true);    
  2173.         alert("Please specify some Numeric Text-To-Send");    
  2174.         processGeneralClick(ActsTab);
  2175.         processBeeperSetup();
  2176.         AL_TTSend.focus();
  2177.         return;
  2178.     }
  2179.     warrAN = AL_PhoneNbr.value.split(";");
  2180.     var PhoneNbr = warrAN.join("[+]");
  2181.     warrAN = AL_PagePswd.value.split(";");
  2182.     var PagePswd = warrAN.join("[+]");
  2183.     APhnb = APhnb + "^"+ PagePswd+";"+PhoneNbr;
  2184.     
  2185.     // inhibit Update Button now 
  2186.     SetButtonState(UUpdateButton,"1");
  2187.  
  2188.     // Determine if ALMode is "New" or "Edit" and send data to DataBase Server appropriately 
  2189.     LastNewName = ANme; // save 
  2190.     
  2191.     if (ALMode == "New") {
  2192.         lpreID = RpmCC_AL.AlertGroupPreliminaryAdd1(ANme,ADsc,AThr,AUnd,AEvt,ADur,ASch,ASdt,AEdt,AAid);
  2193.         prelimID = ""+lpreID; // convert to string
  2194.         rstat = RpmCC_AL.AlertGroupPreliminaryAdd2(prelimID,ARit,AEp,AArg,AEno,AEad,AEs,APhn,APhnb,ATtk,APg,APgnb,ATtn);
  2195.         if ( rstat != (-1) ) {
  2196.             rstat = RpmCC_AL.AlertGroupCommitAdd(prelimID);
  2197.         }
  2198.     }
  2199.     else { // "Edit"
  2200.         OrigName = AL_AlertSel.options[AlertSelectIdx].text; 
  2201.         AltID = getAlertID(OrigName);
  2202.         lpreID = RpmCC_AL.AlertGroupPreliminaryReplace1(AltID,ANme,ADsc,AThr,AUnd,AEvt,ADur,ASch,ASdt,AEdt,AAid);
  2203.         prelimID = ""+lpreID; // convert to string
  2204.         rstat = RpmCC_AL.AlertGroupPreliminaryReplace2(prelimID,ARit,AEp,AArg,AEno,AEad,AEs,APhn,APhnb,ATtk,APg,APgnb,ATtn);
  2205.         if ( rstat != (-1) ) {
  2206.             rstat = RpmCC_AL.AlertGroupCommitReplace(prelimID);
  2207.         }
  2208.     }
  2209.         
  2210.     if ( rstat ) { // if unable to initiate request        
  2211.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  2212.         processResetButton();
  2213.     }
  2214.     else { // waiting for OperationCompleteEvent
  2215.         ignoreDBChangeEvent = true;
  2216.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  2217.         processGeneralClick(CounterTab);
  2218.     }
  2219. }
  2220.  
  2221. /* Update Local Alert Group Table Store after Replace */
  2222. function updateStore(idx) {
  2223.     var SrvCArr = new Array();
  2224.     var PArr = new Array();
  2225.     var WFreqAr = new Array();
  2226.     ANme = AL_Alert.value; // Alert Name
  2227.     AL_AlertSel.options[idx].text = ANme; // Update name in case edited
  2228.     si = AlertRecLength * idx; // index into Store for correct entry
  2229.     AlertStoreArr[si+0] = ANme;
  2230.     AlertStoreArr[si+2] = (AL_Desc.value.length == 0) ? "" : AL_Desc.value; 
  2231.  
  2232.     if ( CurrentAT == ServiceType ) { // if Service Alert
  2233.         // Reset orig settings 
  2234.        for ( var i=0, j=0; i<AC_ServicesStoreArr.length; i+=ServicesRecLength ) {
  2235.            if ( AC_ServicesStoreArr[i+1] == curAGRPID ) {
  2236.                AC_ServicesStoreArr[i+1] = 0; // clear Alert Group ID
  2237.            }
  2238.         }
  2239.         // Update new settings
  2240.         SrvcCArr = SrvCIDArr.split(",");
  2241.        for ( i=0; i<AC_ServicesStoreArr.length; i+=ServicesRecLength ) {
  2242.            if ( AC_ServicesStoreArr[i+2] == curSrvcName ) { // if match on Service Type
  2243.                for ( j=0; j < SrvcCArr.length; j++ ) { // find Computer ID
  2244.                     if ( AC_ServicesStoreArr[i] == SrvcCArr[j] ) { // if match on Comp ID
  2245.                         AC_ServicesStoreArr[i+1] = curAGRPID; // update Alert Group ID 
  2246.                         PArr = AC_ServicesStoreArr[i+3].split("~"); // parse parameter string
  2247.                         WFreqAr = FreqArg.split(","); // get Frequency params & Suspend param
  2248.                         PArr[7] = WFreqAr[0]; PArr[8] = WFreqAr[1]; PArr[9] = WFreqAr[2]; PArr[10] = WFreqAr[3];
  2249.                         PArr[11] = WFreqAr[4];
  2250.                         if ( WFreqAr.length >= 7 ) {
  2251.                            PArr[13] = WFreqAr[5]+","+WFreqAr[6];
  2252.                         }
  2253.                         else {
  2254.                            PArr[13] = "";
  2255.                         }
  2256.                         AC_ServicesStoreArr[i+3] = PArr.join("~"); 
  2257.                         break;
  2258.                     }
  2259.                 }
  2260.            }
  2261.           } 
  2262.         AlertStoreArr[si+3] = MaxAlertsCount;            
  2263.         // Get Alert Dependency Info if any
  2264.         DependencyID = ""; // initialize
  2265.         if ( AL_DependencySel.selectedIndex != 0 ) {
  2266.             var UNM = AL_DependencySel.options[AL_DependencySel.selectedIndex].text;
  2267.             for (var i=0, j=0; i < AlertStoreArr.length; ++j, i+=AlertRecLength) {
  2268.                 if ( AlertStoreArr[i] == UNM ) {
  2269.                     DependencyID = AlertStoreArr[i+1];
  2270.                     break;
  2271.                 }
  2272.             }
  2273.         }
  2274.         AlertStoreArr[si+23] = DependencyID+"]["+Suppress1.join("^")+"]["+Suppress2.join("^")+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  2275.     }
  2276.     else if ( CurrentAT == UserType || CurrentAT == EventLogType || CurrentAT == SyslogCheckType || CurrentAT == FileCheckType || CurrentAT == SNMPTrapType || CurrentAT == WinServicesType || CurrentAT == ProcessCheckType ) { // if User, EventLog, or SNMP Trap Alert
  2277.         AlertStoreArr[si+8] = ASdt;
  2278.         AlertStoreArr[si+9] = AEdt;
  2279.         AlertStoreArr[si+3] = "0";
  2280.         AlertStoreArr[si+4] = "0";
  2281.         AlertStoreArr[si+6] = "0";
  2282.         AlertStoreArr[si+23] = "]["+"]["+"]["+"]["+"]["+AL_WASeveritySel.selectedIndex;
  2283.     }
  2284.     else { // otherwise Counter Alert    
  2285.         AlertStoreArr[si+3] = (AL_Thrsh.value.length == 0) ? "" : AL_Thrsh.value;
  2286.         AlertStoreArr[si+4] = (AL_TUnder.checked) ? "1" : "0";
  2287.         AlertStoreArr[si+6] = (AL_Dur.value.length == 0) ? "" : AL_Dur.value;
  2288.         AlertStoreArr[si+8] = ASdt;
  2289.         AlertStoreArr[si+9] = AEdt;
  2290.         AlertStoreArr[si+10] = OCArray;
  2291.         AlertStoreArr[si+23] = "]["+"]["+"]["+MaxAlertsCount+"]["+((AL_CWRestore.checked)?"1":"0")+"]["+AL_WASeveritySel.selectedIndex;
  2292.     }
  2293.     // Common parameters
  2294.     var warrAN = new Array();
  2295.     warrAN = AL_AccessNbr.value.split(";");
  2296.     var AccessNbr = warrAN.join("[+]");
  2297.     warrAN = AL_PhoneNbr.value.split(";");
  2298.     var PhoneNbr = warrAN.join("[+]");
  2299.     warrAN = AL_PagePswd.value.split(";");
  2300.     var PagePswd = warrAN.join("[+]");
  2301.  
  2302.     AlertStoreArr[si+5] = (AL_EveryT.checked) ? "1" : "0";
  2303.     AlertStoreArr[si+7] = ASch;
  2304.     AlertStoreArr[si+11] = (AL_RunIt.checked) ? "1" : "0";
  2305.     AlertStoreArr[si+12] = (AL_ExecP.value.length == 0) ? "" : AL_ExecP.value;
  2306.     AlertStoreArr[si+13] = (AL_ArgsP.value.length == 0) ? "" : AL_ArgsP.value;
  2307.     AlertStoreArr[si+14] = (AL_ENotify.checked) ? "1" : "0";
  2308.     AlertStoreArr[si+15] = (AL_EAddr.value.length == 0) ? "" : AL_EAddr.value;
  2309.     AlertStoreArr[si+16] = (AL_ESubj.value.length == 0) ? "" : AL_ESubj.value+"[+]"+EmailText.value;
  2310.     AlertStoreArr[si+17] = (AL_Phone.checked) ? "1" : "0";
  2311.     AlertStoreArr[si+18] = AccessNbr + "^"+ PagePswd +";"+PhoneNbr;
  2312.     AlertStoreArr[si+19] = (AL_TTSpeak.value.length == 0) ? "" : AL_TTSpeak.value;
  2313.     AlertStoreArr[si+20] = (AL_Beeper.checked) ? "1" : "0";
  2314.     AlertStoreArr[si+21] = (AL_BeeperNbr.value.length == 0) ? "" : AL_BeeperNbr.value;
  2315.     AlertStoreArr[si+22] = (AL_TTSend.value.length == 0) ? "" : AL_TTSend.value;
  2316.  
  2317. }
  2318.  
  2319. /* Process Click on Delete Button */
  2320. function processDeleteButton() {
  2321.     ALMode = "Delete"; // set mode of operation
  2322.     ANme = AL_Alert.value; // get Alert Name
  2323.  
  2324.     /* ask user to confirm delete */
  2325.     if ( confirm("Are you sure you want to delete: " + ANme + " ?") ) {
  2326.         /* inhibit Edit and Delete now */
  2327.          SetButtonState(UNewButton,"1");    
  2328.         SetButtonState(UEditButton,"1");
  2329.         SetButtonState(UDupButton,"1");
  2330.         SetButtonState(UDeleteButton,"1");
  2331.  
  2332.         AlrtID = getAlertID(ANme);    // Get Alert ID from Name
  2333.         
  2334.         // if Event Log type, delete associated records first
  2335.         if ( CurrentAT == EventLogType ) {
  2336.             // if unable to initiate request        
  2337.             if ( RpmCC_AL.ELMonitorDelAllByAlertGroupID(AlrtID) ) { 
  2338.                 top.Rstatus.Pstat("Unable to delete the EventLogWatch",true);
  2339.                 processResetButton();
  2340.                 return;
  2341.             }
  2342.         }
  2343.         // if SNMP Trap type, delete associated records first
  2344.         else if ( CurrentAT == SNMPTrapType ) {
  2345.             processSNMPTrapDelete(AlrtID);
  2346.             return;
  2347.         }
  2348.         // if Win Services Type
  2349.         else if ( CurrentAT == WinServicesType ) {
  2350.             processWinServicesDelete(AlrtID);
  2351.             return;
  2352.         }
  2353.         // if File Check Type
  2354.         else if ( CurrentAT == FileCheckType ) {
  2355.             // if unable to initiate request        
  2356.             if ( RpmCC_AL.FileCheckDelete(AlrtID) ) { 
  2357.                 top.Rstatus.Pstat("Unable to delete the FileWatch",true);
  2358.                 processResetButton();
  2359.                 return;
  2360.             }
  2361.         }
  2362.         // if Process Check Type
  2363.         else if ( CurrentAT == ProcessCheckType ) {
  2364.             // if unable to initiate request        
  2365.             if ( RpmCC_AL.ProcessCheckDelete(AlrtID) ) { 
  2366.                 top.Rstatus.Pstat("Unable to delete the ProcessWatch",true);
  2367.                 processResetButton();
  2368.                 return;
  2369.             }
  2370.         }
  2371.         // if Syslog Check Type
  2372.         else if ( CurrentAT == SyslogCheckType ) {
  2373.             // if unable to initiate request        
  2374.             if ( RpmCC_AL.SyslogCheckDelete(AlrtID) ) { 
  2375.                 top.Rstatus.Pstat("Unable to delete the SyslogWatch",true);
  2376.                 processResetButton();
  2377.                 return;
  2378.             }
  2379.         }
  2380.         /* send DELETE request to DataBase Server */
  2381.         if ( RpmCC_AL.AlertGroupDelete(AlrtID) ) {
  2382.             top.Rstatus.Pstat("Unable to start the DELETE request",true);
  2383.             processResetButton();
  2384.         }
  2385.         else { // waiting for OperationCompleteEvent
  2386.             ignoreDBChangeEvent = true;
  2387.             top.Rstatus.Pstat("One moment while DELETE request completes");
  2388.         }
  2389.     }
  2390. }
  2391.  
  2392.